1

I wish to create my own Signup System and I'm having difficulty with Email Existence Verification. I'm using this following PHP script posted on https://www.mywebcode.com/verify-email-address-check-if-real-exists-domain-php/ as verify_email_library.inc.php in my website. This script is able to work and check entered email existence perfectly on my localhost Xampp Server. But when I upload my website on my Google VM Instance Ubuntu, this script doesn't work in any way. Can someone let me know what I will have to configure or install on my VM Instance. Thanks

verify_email.php:

<?php
    include_once "verify_email_library.inc.php";
    $vmail = new VerifyEmail();
    $vmail->Debug= TRUE;
    $vmail->Debugoutput= "html";
    echo "<p>".($vmail->check("EMAIL@gmail.com") ? "Email Exists" : "Email doesn't Exists");
?>

The error I'm getting:

gmail-smtp-in.l.google.com:Connection timed out
alt1.gmail-smtp-in.l.google.com:Connection timed out
alt2.gmail-smtp-in.l.google.com:Connection timed out
alt3.gmail-smtp-in.l.google.com:Connection timed out
alt4.gmail-smtp-in.l.google.com:Connection timed out
All connection fails
Email doesn't Exists
  • Google is probably blocking the VM from connecting outbound on the SMTP port (TCP/25). – peeebeee Jul 28 '19 at 06:31
  • @peeebeee Yeah so how and where do I allow this? –  Jul 28 '19 at 07:27
  • @AmandeepSingh Google doesn't use port 25 for SMTP. So if Google is blocking it, there's nothing you can do. But if it worked locally, then maybe they do allow some service over port 25 for this verification purpose. So perhaps it's more likely then that Ubuntu cloud or your own VM is blocking the outbound port. Check the firewall settings and/or contact the support team – ADyson Jul 28 '19 at 08:01
  • 1
    @AmandeepSingh You don't, see https://cloud.google.com/compute/docs/tutorials/sending-mail/ (All very Google-able) – peeebeee Jul 28 '19 at 08:32

1 Answers1

2

As per the google cloud compute documentation:

By default, Google Compute Engine allows outbound connections on all ports but port 25, which is blocked because of the risk of abuse. All other ports are open, including ports 587 and 465.

You will need to use a different hosting service, or use a proxy/tunnel/vpn if you wish to make SMTP connections.

atymic
  • 3,093
  • 1
  • 13
  • 26
  • [Both ports](https://stackoverflow.com/questions/15796530/what-is-the-difference-between-ports-465-and-587) are meant for SMTP. Google mailer allows and probably prefers encrypted connections anyway. – Álvaro González Jul 28 '19 at 08:13
  • 1
    He's trying to verify arbitrary emails, so I don't think it's scoped to google emails only. – atymic Jul 28 '19 at 08:20
  • Hmmm... I had assumed he's validating emails by actually sending messages (the only reliable way) but perhaps he's checking MX records and asking the end server. We don't really know what library he's using or how it works. [Edit: yes, we do, there's a link, sorry] – Álvaro González Jul 28 '19 at 08:29