3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $fp = fsockopen("ssl://smtp.gmail.com", 587, $errNo, $errStr, 15); if(!$fp){ echo "not connected"; }else{ $str = fputs($fp, "EHLO"."\r\n")."\n"; $str .= fputs($fp, "STARTTLS"."\r\n")."\n"; $str .= fputs($fp, "AUTH LOGIN"."\r\n"); $str .= fputs($fp, base64_encode("murarijaiswal1989@gmail.com")."\r\n")."\n"; $str .= fputs($fp, base64_encode("murari1989.")."\r\n")."\n"; $str .= fputs($fp, "MAIL FROM:<author@gmail.com>"."\r\n")."\n"; $str .= fputs($fp, "RCPT TO:<murari@fecdirect.in>"."\r\n")."\n"; $str .= fputs($fp, "DATA"."\r\n")."\n"; $str .= fputs($fp, "Subject: This is subject"."\r\n")."\n"; $str .= fputs($fp, "This is body message"."\r\n")."\n"; $str .= fputs($fp, "."."\r\n")."\n"; $str .= fputs($fp, "QUIT"."\r\n")."\n"; echo fputs($fp, $str); fclose($fp); } ?>
based on t9tg2
Output for 5.4.15 - 5.4.45, 5.5.32 - 5.5.33, 5.6.18 - 5.6.19, 7.0.4, 7.0.20, 7.1.5 - 7.2.0
Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: System error in /in/sU5Vd on line 2 Warning: fsockopen(): unable to connect to ssl://smtp.gmail.com:587 (php_network_getaddresses: getaddrinfo failed: System error) in /in/sU5Vd on line 2 not connected
Output for 5.5.24 - 5.5.31, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.0.6, 7.1.0
Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/sU5Vd on line 2 Warning: fsockopen(): unable to connect to ssl://smtp.gmail.com:587 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /in/sU5Vd on line 2 not connected
Output for 5.3.19 - 5.4.14
Warning: fsockopen(): unable to connect to ssl://smtp.gmail.com:587 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in /in/sU5Vd on line 2 not connected