Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Image URL broken during mail

12:51 pm on Oct 5, 2009 (gmt 0)

Full Member

10+ Year Member

joined:Jan 27, 2005
posts: 229
votes: 0

When I send an email newsletter, everything looks good except often one image will be broken. Here's an example:


turns to this in the email:


Can I protect it from being altered? What's causing !%20 being added?

This is my mail method:

public static function send_html($to, $from, $reply_to, $subject, $message) {
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $reply_to . "\r\n";
//$headers .= "CC: " . $cc . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $subject, $message, $headers);

[edited by: eelixduppy at 4:01 pm (utc) on Oct. 5, 2009]
[edit reason] switched to example.com [/edit]

8:50 pm on Oct 5, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:June 10, 2008
posts: 1130
votes: 0

Where is your message getting created? Try doing a var_dump on your message at the beginning of the function you posted, and see if it is what it is supposed to be. Then you know it is a problem with the mail function and not your code.
11:28 am on Oct 6, 2009 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member themadscientist is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 14, 2008
votes: 62

andrewsmd has a good idea, also here are a couple of questions:

Is the img url the only thing on the line in the compilation of the $message (IOW: \nhttp://www.example.com/files/thumbs/151_32_wYHGFcibTh.JPG\n) and are you using wordwrap()?

Your mail function looks fine.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members