Hi, I am new to sending email
especially HTML email.

I want to include some images bit am not sure if this will work:

// message
$message = "Hello $friend_name, this message is from $sender_name \n";
$message .= "Email address : $sender_email \n \n";
$message .= $message1;

$message = $message.'
<html>
<head>
<title>Yodbod.com the Free Ads site</title>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="1" >
<tr>
<td rowspan = "2" ><img alt="yod" src="yod.jpg" height="140" width="100"/></td>
<td ><img alt="bod" src="bod1.jpg"/></td>
<td><img alt="bod" src="simpler.jpg"/></td>
</tr>
<tr><td><img alt="bod" src="<?php echo "$x_pix1"; ?>"/></td></tr>
</table>
</body>
</html>
';

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'From: Postcard Central <postcards@yodbod.com>' . "\r\n";
$headers .= 'Bcc: boss@yodbod.com' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);

Will the images in the HTML content be sent with my "postcard" or will they just be referenced to my server ? - I don't want to drain my server resources I would rather send the images ... bt how ?

Thanks

    no they will not be sent. You are sending HTML that's all. If you want the images to show up in the html, you will need to use an absolute reference for your image URLs. As for sending the images as attachments with the email, you'll pay for the bandwidth either way. In fact, if you plan on mass mailing, you'll use more bandwidth sending copies of the images with each email. Of course this depends on my assumption that people generally read this kind of email just once or a couple times.

      I have just read about multi-part MIME
      but from what you say it might be easier and more efficient to just cahge my URL s ? Then at the least tyhe recipient will get the picture in the email ??

      Is that all I have to do ?

        Right, it is easier to simply put in the URLs and not send the images as attachments (which involves a binary write, base64 encoding, and chunking...all possible with PHP.) Alternately, you could just use this pre-made PHP email class if you really wanna send those images. You can find it here .

        Have fun.

          Originally posted by bretticus
          Right, it is easier to simply put in the URLs and not send the images as attachments

          Although anyone who has any regard for security doesn't allow their email client to request or load remote images in the first place.

            anyone who has any regard for security doesn't allow their email client to request or load remote images in the first place.

            Which accounts for about 0.5 % of the users out there. 😃

              When you say "anyone who has any regard for security doesn't allow their email client to request or load remote images in the first place." Do you mean that if someone is working in a company on a company server and getting email then the company computer team would for security reasons block the loading of images ?

              Surely an attached images would have the same sercurity issues ? So there is no diferece between including the image with the email and allowing the remote load of it -- is there ?

              I guess this wouldn't effect the millions of home users or internet cafe users anyway ?? would it ?

              Are you suggesting including the image in the email is better ?

              Thanks for your imput I want to increase my understanding.

              Dave

                Spammers often send emails in html format that call remote images. The reason for this is they can tag the URLs with an id to identify the email they sent to. That enables them to know your email is valid. I suppose there is the possibilty of including malicious client scripts--all depends on your email client, browser, or web-based provider. For example, gmail (google mail) disables external img urls by default. Hope this sheds some light, others may have more light to shed on the subject.

                Personally, you are doing no harm (I assume). My company has sent plenty of emails (we do not spam) with absolute img urls and experienced no problems. Like I said maybe 1-2% of users out there even worry about it (more should but a lot of them have email with spam filtering and alot of those get blocked or modified before hitting their mailboxes.)

                  Write a Reply...