Edward Posted July 11, 2007 Share Posted July 11, 2007 Hi, I'm trying to send HTML emails via my site to people who enter their email address in a form. When I add an image to the email (as basic as <img src="photo.jpg" />) the email doesn't send. I still get a message on the screen to say it's sent (by using if 'mail' then echo 'ok' etc) but it's never received. It works on one of my websites but not the other. Could it be the domain provider or their php configuration? I can't think what else it could be and I NEED to sort it. Please can someone help! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/59493-images-in-html-emails-stops-the-email-sending/ Share on other sites More sharing options...
jkkenzie Posted February 6, 2009 Share Posted February 6, 2009 I also have almost the same problem and it seems no one is around to help us. Mine sends the html email but the image doesn't appear, its only shows the placeholder of the image is showing. Do you mind posting how you send your html email? Good luck Quote Link to comment https://forums.phpfreaks.com/topic/59493-images-in-html-emails-stops-the-email-sending/#findComment-755773 Share on other sites More sharing options...
blueman378 Posted February 6, 2009 Share Posted February 6, 2009 Hi mate you say it works on one site but not the other, are these sites hosted on a different server to each other? Quote Link to comment https://forums.phpfreaks.com/topic/59493-images-in-html-emails-stops-the-email-sending/#findComment-755844 Share on other sites More sharing options...
Mark Baker Posted February 6, 2009 Share Posted February 6, 2009 <img src="photo.jpg" /> So when the recipient views the e-mail on their own machine, you expect it to automatically know which of the 6million+ machines on the Internet has the file photo.jpg ?? Quote Link to comment https://forums.phpfreaks.com/topic/59493-images-in-html-emails-stops-the-email-sending/#findComment-755848 Share on other sites More sharing options...
Edward Posted February 6, 2009 Author Share Posted February 6, 2009 @Mark: I think it was pretty obvious I wouldn't expect that. If you re-read my post you'll see that the problem wasn't getting the image to display, the problem was getting the email to send, which failed when the HTML image tag was included. @blueman378: Hi mate, yes the two sites were hosted by different hosting companies and were subsequently on different servers. One of them worked fine but not the other. I think the one that worked was Linux and the one that failed was Windows. @jkkenzie: Hi, I'm trying to remember what the issue was and how I resolved it, as this post was some time ago (July 2007)! If I remember correctly (which I may not), the problem wasn't specifically relating to the HTML image tag, but to the amount of characters in the email, which was obviously changing when I added or deleted the image tag. I think the issue related to base64 encoding. I don't have much knowledge of this but in short, forward slashes were being added in to my email which were affecting the output. I used the following which I think was the solution: $headers .= "Content-Transfer-Encoding: base64\r\n"; // Add this to your headers $body = rtrim(chunk_split(base64_encode($body))); // Add this to your body mail($recipient, $subject, $body, $headers) // This is how I was sending the mail Perhaps you could try that and see if it helps? If not, let me know and I'll think again. Quote Link to comment https://forums.phpfreaks.com/topic/59493-images-in-html-emails-stops-the-email-sending/#findComment-755911 Share on other sites More sharing options...
jkkenzie Posted February 10, 2009 Share Posted February 10, 2009 Thanks, i also got mine working, though am not using base64 am just using \r\n and that is it. Maybe when i get the same problem , i will remember this. Thanks so much Quote Link to comment https://forums.phpfreaks.com/topic/59493-images-in-html-emails-stops-the-email-sending/#findComment-758749 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.