Page 1 of 1

blob images in mail()

Posted: Thu Sep 22, 2005 10:13 am
by Catz
Hi

I have a script that successfully sends a message:

(The Basic Script):

Code: Select all

$from = "me@myemail.co.za";
$subject = "Test E-Mail";

$headers = "MIME-Version: 1.0\r\n"; 
$headers = "From: My Email<$from>\n"; 
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 

$message = "This is an html message with images";
$message .= "<img src='http://www.mywebsite.com/images/logo.jpg' width='60' height='60'>";
$message .= "<img src=''http://www.mywebsite.com/view.php?ID=$ID";

if (mail($email,$subject,$message,$headers)) { 
echo "Message has been sent";
}
else {
   echo "Message was not sent <p>";
   exit;
}
The email sends fine, the logo displays fine, but the blob image comes up blank. If I copy the url directly into my browser the blob image displays with no problem. Any ideas?

Thanks!

Posted: Thu Sep 22, 2005 10:21 am
by feyd
yar html for the "blob" has scurvy, yar.

Code: Select all

$from = "me@myemail.co.za";
$subject = 'Test E-Mail';

$headers = "MIME-Version: 1.0\r\n";
$headers = "From: My Email<$from>\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

$message = 'This is an html message with images';
$message .= '<img src="http://www.mywebsite.com/images/logo.jpg" width="60" height="60" />';
$message .= '<img src="http://www.mywebsite.com/view.php?ID='.$ID.'" />';

if (mail($email,$subject,$message,$headers)) {
echo "Message has been sent";
}
else {
   echo 'Message was not sent <p>';
   exit;
}
try that, matey.

Posted: Thu Sep 22, 2005 10:21 am
by Maugrim_The_Reaper

Code: Select all

$message .= "<img src=''http://www.mywebsite.com/view.php?ID=$ID";
Methinks the second is not quite valid html...?

Corrected:

Code: Select all

$message .= "<img src='http://www.mywebsite.com/view.php?ID=$ID'>";

Posted: Thu Sep 22, 2005 10:26 am
by Catz
I've also tried:

Code: Select all

$message .= "<img src='http://www.mywebsite.com/view.php?ID=" . $ID . "'>";
without success...

Posted: Thu Sep 22, 2005 10:28 am
by feyd
some mail clients will block image links that look like trackers, yar... yours does indeed look like a tracking image... yar..

Posted: Thu Sep 22, 2005 10:28 am
by John Cartwright
are you using a form? if so is the method set to POST or GET
$_POST['ID'] or $_GET['ID']

if its coming from the url use $_GET['ID']

Posted: Thu Sep 22, 2005 10:32 am
by Maugrim_The_Reaper
Have viewed text prior to sending? i.e. the html received by client?

Maybe $ID not being set...or its being blocked...or you need a superglobal...or...