Hi mirza hussain,
This is not a SQL Server configuration issue. The error “mail server not reachable” indicates that SQL Server cannot establish a network/TLS connection to Gmail’s SMTP service.
Please check the following (these are mandatory for Gmail):
Use only SMTP port 587
Port 25 is usually blocked by ISPs, corporate firewalls, and cloud providers. Gmail also does not recommend using it.
Use:
Server: smtp.gmail.com
Port: 587
Enable SSL: Yes
Use a Gmail App Password
Gmail no longer allows SMTP access using the normal account password.
Enable 2‑Step Verification on the Gmail account
Generate an App Password
Use the App Password in the Database Mail account
Verify TLS 1.2 is enabled on Windows Server 2019
Gmail requires TLS 1.2. If TLS 1.2 is disabled at the OS level, Database Mail will fail with this exact error.
Test SMTP connectivity from the OS (important)
From the SQL Server machine, run:
PowerShellTest-NetConnection smtp.gmail.com -Port 587Show more lines
If this fails, the issue is network/firewall related, and Database Mail will not work until outbound 587 is allowed.
Check Database Mail logs for the exact failure reason
SQLSELECT * FROM msdb.dbo.sysmail_event_log ORDER BY log_date DESC;Show more lines
If the server is hosted (Azure VM, cloud, or corporate network), outbound SMTP is often blocked by policy. In that case, Gmail SMTP will not work until the firewall allows it.
Thanks,
Lakshmi.