Jump to content

[SOLVED] showing image in php mail


contra10

Recommended Posts

i'm trying to show an image in my email but i can't seem to view it in the email

 

<?php
$to = ($email);
$subject = "Verification";
//create a boundary string. It must be unique 
//so we use the MD5 algorithm to generate a random hash
$random_hash = md5(date('r', time()));
$from = "[email protected]";
$headers = "From: $from";
//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; 
//define the body of the message.
ob_start(); //Turn on output buffering
?>

--PHP-alt-<?php echo $random_hash; ?>  
Content-Type: text/html; charset="iso-8859-1" 
Content-Transfer-Encoding: 7bit

<IFRAME src="http://www.test.com/image.html" width="200" height="100" FRAMEBORDER="0"></iframe>
<div style="width:800px;height:400px;border:4px dashed blue;">
<?php echo "<IFRAME src= 'http://test.com/image.html' width='200' height='100' FRAMEBORDER='0'></iframe>";?>
<h2>You have sucessfully registered</h2><br>
<table bgcolor="#0183AE"><tr><td>
<?php

echo "To contine to verify your account please follow the link<a href='http://test.com/verify.php?v=$userid' target='_blank'>Verify Account</a>";
?>
</td></tr></table>
</div>

--PHP-alt-<?php echo $random_hash; ?>--
<?php
//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();
//send the email
$mail_sent = @mail( "$to", $subject, $message, $headers );

?>

test.com is just a spoof name, im actually testing it on a real web server

Link to comment
https://forums.phpfreaks.com/topic/149204-solved-showing-image-in-php-mail/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.