Code: Select all
<?php
$to = "email@emailaddress.com";
$subject = "a title";
$random_hash = md5(date('r', time()));
$headers = "From: some@addy.com\r\nReply-To: some@addy.com";
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
$file = file_get_contents("http://www.somewhere.com/sml_image.jpg");
ob_start();
?>
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<table border="2" bordercolor="#000066" style="border-collapse:collapse" cellpadding="0" cellspacing="0" width="700" height="auto">
<tr>
<td>****place the image here****</td>
</tr>
<tr>
<td>***content***</td>
</tr>
</table>
--PHP-alt-<?php echo $random_hash; ?>--
<?
$message = ob_get_clean();
$mail_sent = @mail( $to, $subject, $message, $headers );
echo $mail_sent ? "Mail sent " : "Mail failed";
?>
Code: Select all
<?php
header ('Content-Type: image/jpg');
imagejpeg(imagecreatefromstring($file), null,100);
?>