PHP

HOW TO SEND IMAGES WITH PHP MAIL

MAIL MESSAGE $mailBody = "<img src='HTTP://SITE.COM/IMG.JPG'/>";

HOST IMAGE ON SERVER

01

MAIL HEADER $mailHead = implode("\r\n", [   "MIME-Version: 1.0",   "Content-type: text/html;".   "charset=utf-8" ]);

SEND MAIL mail("jon@doe.com", "Subject", $mailBody, $mailHead);

MAIL MESSAGE $img = file_get_contents('IMG.JPG'); $imgdata = base64_encode($img); $mailBody = "<img src='data:image/x-icon;base64,$imgdata'/>";

EMBED IMAGE INTO EMAIL

02

MAIL HEADER $mailHead = implode("\r\n", [   "MIME-Version: 1.0",   "Content-type: text/html;".   "charset=utf-8" ]);

SEND MAIL mail("jon@doe.com", "Subject", $mailBody, $mailHead);