php mail with attachment
Posted: Sun Feb 06, 2011 9:45 am
I have a php mail script on my website that automatically generates an email with a selected image as an attachment. The idea is that the user can select an image from a library, then fill out a form with the recipient name and email address, and the script then automatically generates and sends an email with the selected image attached.
The script is a fairly standard one, which sets up the headers and encodes the jpg image in base64 encoding, before using the php mail() function to send the email the the chosen recipient. This seems to work fine when the email is downloaded and viewed through a client such as Outlook, but when I have tried accessing the email through webmail facilities such as BT/Yahoo, I find the email arrives and it shows an attachment 'paperclip', but no body text or attachment can be seen.
I have looked at the headers for the received email, and I can see the following within the header: Received-SPF: none. I understand this means the host server does not contain a SPF Record, and wonder if this might make the webmail antivirus reject the incoming email, but I am not sure if this is correct.
Has anyone else experienced the same difficulty with this? It's getting quite frustrating, as the script works fine when receiving the email through an email client on your machine, but I want to ensure it works on everything before I let others use it.
I would really appreciate any help with this.
Rob.
The script is a fairly standard one, which sets up the headers and encodes the jpg image in base64 encoding, before using the php mail() function to send the email the the chosen recipient. This seems to work fine when the email is downloaded and viewed through a client such as Outlook, but when I have tried accessing the email through webmail facilities such as BT/Yahoo, I find the email arrives and it shows an attachment 'paperclip', but no body text or attachment can be seen.
I have looked at the headers for the received email, and I can see the following within the header: Received-SPF: none. I understand this means the host server does not contain a SPF Record, and wonder if this might make the webmail antivirus reject the incoming email, but I am not sure if this is correct.
Has anyone else experienced the same difficulty with this? It's getting quite frustrating, as the script works fine when receiving the email through an email client on your machine, but I want to ensure it works on everything before I let others use it.
I would really appreciate any help with this.
Rob.