3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file_name='pic1.jpg'; $to = ''; $subject = 'Приветствие'; $from = ''; $boundary = 'qwe'; $headers = 'From: '; $headers .= 'Content-type: multipart/mixed; boundary="'.$boundary.'"'; $headers .= 'Mime-Version: 1.0'; $headers .= 'Reply-To: '; $headers .= 'X-Mailer: php/' . phpversion(); $message = '\n--'.$boundary.'\n\n'; $message .= 'Content-type: text/html; charset=utf-8\n'; $message .= '\n <html> <head> <title>Приветствие</title> </head> <body> <div style="width: 100%"> <div style="width: 500px; height: 100%; border: 1px solid black; text-align: left; margin: 0 auto; position: relative; font-family: Times New Roman"> <div style="margin: 25px">Благодарю за подписку!</div> <div style="margin-top: 25px; margin-left: 25px"> <img alt="превью" src="cid:pic1" /> </div> <div style="margin: 25px; margin-top: 25px; text-align: right">С уважением,</div> </div> </div> </body> </html>\n\n '; $message.= '\n\n--'.$boundary.'\n'; $message.= 'Content-Type: image/jpeg; name="'.basename($file_name).'"\n'; $message.= 'Content-Transfer-Encoding: base64\n'; $message.= 'Content-ID: pic1\n\n'; $f=fopen($file_name,'rb'); $message.= base64_encode(fread($f,filesize($file_name))).'\n'; $message.= '--'.$boundary.'--\n\n'; mail($to, $subject, $message, $headers); ?>

preferences:
47.07 ms | 410 KiB | 5 Q