Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gmail SMTP email test using fsockopen
function doctype() {
if (qa_get_logged_in_handle() === 'admin') {
echo "Starting tests...<br>\n";
if(!fsockopen("www.google.com", 80, &$errno, &$errstr, 15))
echo "www.google.com 80 - $errstr ($errno)<br>\n";
else
echo "www.google.com 80 - ok<br>\n";
if(!fsockopen("smtp.gmail.com", 465, &$errno, &$errstr, 15))
echo "smtp.gmail.com 465 - $errstr ($errno)<br>\n";
else
echo "smtp.gmail.com 465 - ok<br>\n";
if(!fsockopen("smtp.gmail.com", 587, &$errno, &$errstr, 15))
echo "smtp.gmail.com 587 - $errstr ($errno)<br>\n";
else
echo "smtp.gmail.com 587 - ok<br>\n";
echo "Tests finished...<br>\n";
echo phpinfo();
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.