Question

With the recent release of App Engine 1.7.7, it is finally possible to make outbound connections with TCP or UDP sockets. This opens a whole world of new possibilities.

Using import socket in Python 2.5, I have been able to test successfully a few simple low-level commands (such as socket.getaddrinfo("smtp.gmail.com", 587)...)

I am now trying to initiate an authenticated SMTP connection on port 587:

import smtplib
session = smtplib.SMTP('smtp.gmail.com', 587)

... but I immediately encounter a NotImplementedError from the gethostbyaddr function in _remote_socket.py. This is surprising, as the non-implementation of this function is not mentioned in the Google App Engine Sockets API Overview at https://developers.google.com/appengine/docs/python/sockets/overview

Any idea what's going on here, and how I could circumvent this limitation?

Note : I have not yet migrated to Python 2.7. I am still using Python 2.5 and old_dev_appserver.py for the development server.

Thank you.

Was it helpful?

Solution

Could you try passing in local_hostname to the constructor?

session = smtplib.SMTP('smtp.gmail.com', 587, local_hostname='appengine.google.com')

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top