Using outlook I can send emails with images inserted into message body(not as attachment). How can i do that using mail() function from PHP?
I would recommend Swift Mailer:
http://swiftmailer.org/docs/embedding-files
Note the $message variables contents, and the value of the $headers variable.
$to = "[email protected]";
$subject = "HTML Email";
$message = "Hello <img src='http://mysite.com/world.jpg' />";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: HTML Emailer <[email protected]>' . "\r\n";
mail($to, $subject, $message, $headers);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With