PHP
(simple examples)
RANDOM BOUNDARY $bound = md5(time());
EMAIL HEADER $head = implode("\r\n", [ "MIME-Version: 1.0", "Content-Type: multipart/mixed; boundary=\"$bound\'"' ]);
$body = implode("\r\n", [ "--$bound", "Content-type: text/html; charset=utf-8", "", "<p>MAIL MESSAGE</p>" ]);
$file = "pic.jpg"; $body .= implode("\r\n", [ "", "--$boundary", "Content-Type: application/octet-stream; name=\"'.basename($file)."\"", "Content-Transfer-Encoding: base64", "Content-Disposition: attachment", "", chunk_split(base64_encode (file_get_contents($file))), "--$boundary--" ]);
echo mail("jon@doe.com", "Subject", $body, $head) ? "OK" : "ERROR" ;