Skip to content Skip to sidebar Skip to footer

What Mail Service Errors Can Appengine Produce?

I would like to control and embed my send() calls in a try/except, but I'm not sure of what errors it can produce. Looking around the SDK, it seems like MailServiceError is the one

Solution 1:

Here are the exceptions that can be thrown by a call to send(): https://developers.google.com/appengine/docs/python/mail/exceptions

Here's an example of how you could catch these:

from google3.apphosting.api import mail

# other code to create 'message' heretry:
  message.send()
except mail.InvalidSender, e:
  # Do something special for an invalid sender errorpassexcept mail.Error, e:
  # This will catch all the other exceptions in the doc above.pass

Post a Comment for "What Mail Service Errors Can Appengine Produce?"