Forums

Servname not supported for ai_socktype

Hi,

I'm trying to set up emailing in my app to have a proper registration process. However, the build-in web2py mailing throws the following error:

WARNING:web2py:Mail.send failure:[Errno -8] Servname not supported for ai_socktype

Could anybody tell me where to start with the error analysis? Google points to issues with /etc/services , but I'm not sure if this applies in this case.

Update: it works on a clean, new version of web2py (V. 2.9.5). I installed a new web2py app and only applied the smtp settings, changing nothing else.

We had that issue a while ago and we fixed it. Are you using a non-standard email port?

smtp.office365.com port 587. Seems pretty standard to me, no? But as indicated, the problem seems to be on my side, as it works now with an updated web2py version.

Yup that does seem standard. It's really weird that web2py could fail in a way that caused that error, though.

Sorry Glenn, I gotta come back to you on this one.

The working version ran under <username>.pythonanywhere.com

The same code to send mails does not work in another app when using a custom domain "euinsight.eu" (goDaddy, CNAME configured). I also have here mandatory https if that could have an influence. Despite the named differences, everything else it the same. Any Ideas?

That's even weirder. Both of those sites are on the same machine so I'd expect them to behave identically. When you say they are the same do you mean that they are clones or that they use they same files? If they're clones, you could do a diff of the directories and see whether there are any differences that might not be obvious when you're working through web2py.

The differences that you mention should have no effect since they're only about how a request gets to your app. Everything should be the same from the point-of-view of the app. One thing just occurred to me that has tripped up users before (though the specific ones were with Django). Does web2py have a notion of a "site name" in its settings that may need to be different for the different domains? I'm really grasping at straws, here.

So after some frustrating hours trying different modifications, a simple App restart "solved" the issue without any changes in the code. I am still in the dark though what could have been the cause. But happy it works now!