PDA

View Full Version : Using text file for body of email


mjl927
02-24-2009, 04:42 PM
I'm having some trouble in PERL. I want to read a text file and use that data as the body of an email message. I want the body to appear just as it does in the text file, preserving new lines and so forth. I'm familiar with reading text files in PERL and I'm familiar with creating simple mailers. But I'm struggling with this particular aspect. Any help would be appreciated. Thanks.

KevinADC
02-24-2009, 05:57 PM
Pretty much near hopeless. There is no way you can control the email client that recieves the email. The email client can format your message anyway its set to, plain text, html, etc.

mjl927
02-24-2009, 06:20 PM
Okay, that makes sense. I can live with the text not appearing EXACTLY like the original text file. Assuming then that I want to just get as close as possible, is there a preferred way to do what I'm asking?

KevinADC
02-24-2009, 06:45 PM
probaly the old keep lines to under 72 characters in length is the best and easiest thing. Otherwise you can try reading RFC 2822 ( I think thats the correct one ) which will probably just give you a headache. You can try sending the message as content-type text/plain and that might also help.

oesxyl
02-25-2009, 06:00 AM
probaly the old keep lines to under 72 characters in length is the best and easiest thing. Otherwise you can try reading RFC 2822 ( I think thats the correct one ) which will probably just give you a headache. You can try sending the message as content-type text/plain and that might also help.
ietf reserved rfc 5321 for smtp and rfc 5322 for mail, both standard now

rfc 5322 is in fact rfc 2822.

http://tools.ietf.org/html/rfc5322

see also:

http://tools.ietf.org/html/rfc2045
http://tools.ietf.org/html/rfc2046
http://tools.ietf.org/html/rfc2047
http://tools.ietf.org/html/rfc2048
http://tools.ietf.org/html/rfc2049

I don't know but I guess you can find on cpan some package what already implement this.

best regards