Email notification fails

In the Log I get Failed to send message: etc
“NativeErrorCode”:10051 etc

The odd thing is that the setup works fine on a different internet connection. But using Sendemail to test the email settings, that testing works fine.

This is doing my head in … I have about 10 sites which are working fine, but the most recent 3 installs I have done all have the above problem.

Hoping someone can help.

Posting more complete error messages can increase the chance. Fortunately I found a possible example:

Jun 25, 2018 9:30 AM: Failed to send message: System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable network 8.8.8.8:53
{
"NativeErrorCode":10051,
"ClassName":"System.Net.Sockets.SocketException",
"Message":"A socket operation was attempted to an unreachable network",

If that’s like what you saw, then WSAENETUNREACH (10051) Network is unreachable. may explain it as something in the network reporting it couldn’t get to the server. Possibly your different connections take a different path to the server. You could run the tracert or traceroute command to see what route it’s taking.

You can also see if you’re getting additional Destination unreachable messages when you get that 10051:

C:\>netstat /s | find "Unreachable"
  Destination Unreachable   105612      709679
  Destination Unreachable   17678       23553

C:\>

Though it’s a rather advanced technique, Wireshark could give an even better view of packets and errors.

The “different internet connection” isn’t real clear, but I’m assuming it refers to a different site and network. Are there commonalities among the working network connections, and differences from those that failed?

THANK YOU !!! This was really useful information and I have now solved the problem.

I had specified this email URL which interestingly does work on most systems (using Draytek routers) …
send-mail-url=smtp.gmail.com/?starttls=always

Changed this to the following, and this now works on the recent systems (using Huawei routers) …
–send-mail-url=smtp://smtp.gmail.com:587/?starttls=always