Search code examples
smtpgmailgoogle-workspace

Failure Sending Mail using GSuite SMTP


I have a very curious issue with an application. When debugging locally, I can send emails just fine using a client's G Suite email credentials:

<smtp deliveryMethod="Network" from="[email protected]">
    <network defaultCredentials="false" 
             host="smtp.gmail.com" 
             port="587" 
             userName="[email protected]" 
             password="supersecret" 
             enableSsl="true" />
  </smtp>

Now, it's very important to note that the application will send just fine with the credentials when running on localhost using Visual Studio. However, when deploying to LIVE and using the exact same credentials, the application refuses to send and I only get the canned response back saying "Failure Sending mail".

I have enabled "less secure applications" in the settings and have verified the "suspicious activity" from the server's IP address. I can also log in to the Gmail account from the server using RDP and opening Firefox to go to Gmail.com.

No firewall rule has been set to block SMTP or anything on port 587.

UPDATE: the materialized error message is

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 74.125.192.108:587

74.125.192.108 being smtp.gmail.com's IP Address (or one of them, at least)

UPDATE 2: I can also not get Thunderbird on the remote server to send an email using the supplied credentials, however it can connect via IMAP and download the contents of the inbox just fine.


Solution

  • Well in this very specific case, it was the fault of the Amazon infrastructure this application ran on. Either amazon themselves, or the reseller changed a policy that ended up blocking communications on ports 465, 587 and 993 (and probably others too).

    The "solution" was to nag them to sort it out.