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); ?>
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.24, 8.2.0 - 8.2.11
Warning: fopen(): open_basedir restriction in effect. File(pic1.jpg) is not within the allowed path(s): (/tmp:/in:/etc) in /in/7IUWJ on line 42 Warning: fopen(pic1.jpg): Failed to open stream: Operation not permitted in /in/7IUWJ on line 42 Warning: filesize(): open_basedir restriction in effect. File(pic1.jpg) is not within the allowed path(s): (/tmp:/in:/etc) in /in/7IUWJ on line 43 Fatal error: Uncaught TypeError: fread(): Argument #1 ($stream) must be of type resource, bool given in /in/7IUWJ:43 Stack trace: #0 /in/7IUWJ(43): fread(false, false) #1 {main} thrown in /in/7IUWJ on line 43
Process exited with code 255.

preferences:
74.24 ms | 407 KiB | 5 Q