Forum Moderators: coopster

Message Too Old, No Replies

E-mail a Plain Text file as an Attachment

E-mail a Plain Text file as an Attachment

         

jpmadmin

10:43 pm on Oct 18, 2011 (gmt 0)

10+ Year Member



In PHP, how do you E-mail a plain Text file (ex. 123.txt) as an Attachment ?

The E-mail text may read:

Hi _____,

Please see the attachment for further instructions.

Thanks,
Bob


I literally need the Text file to be a regular E-mail attachment -- and not imbedded within the E-mail text.

Thanks,
Pat

rocknbil

4:53 pm on Oct 19, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The same way you'd do any other email attachment, here's one [webmasterworld.com] of a few thousand discussions.

The important thing is to set a header as octet-stream or bad/type (just for example, anything non-existent), not text/plain, for the attachment. Sending a text/plain header for the attachment will cause (most) email clients to drop it into the body of the email.

I wouldn't use the email format you have above though. That looks and sounds **precisely** like most of the virus/malware payloaded spam emails I get. :-)