Hi,
My question is: How can i send the html and image by mail using mail().
jpeg or any image file -> it has to be inline not a attachment.
also i want to use html in my mail message for sending a link to my customers.
I know how the mail function works but when i send the email the messege is empty.
my code is:
<form action="test2.php?act=submit" method="post">
<input type="submit" value="Send" name="Submit">
</form>
<?php
$act = $_REQUEST['act'];
if($act == 'submit')
{
$boundary = '-----=' . md5( uniqid ( rand() ) );
$email = '
[email protected]';
$thefile = 'http://www.bestalternative.com/images/img/logo2.gif';
$subject = 'from php';
$message = "Content-Type: image/gif; name=\"my attachment\"\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "Content-Disposition: inline; filename=\"$theFile\"\n\n";
$content_encode = chunk_split(base64_encode($content));
$message .= $content_encode . "\n";
$message .= "--" . $boundary . "\n";
$headers = "From: \"Me\"<
[email protected]>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
// Additional headers
$headers .= 'From: Mani Heravi <
[email protected]>' . "\r\n";
mail($email, $subject, $messege, $headers);
}
?>
Any idea.
Thanks
Regards
Mani_he