Skip to content

Instantly share code, notes, and snippets.

@pupi1985
Created November 11, 2014 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pupi1985/67aff930780d8848d0b9 to your computer and use it in GitHub Desktop.
Save pupi1985/67aff930780d8848d0b9 to your computer and use it in GitHub Desktop.
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