Here's the code I'm using to send mail (not exactly, I have a different body, subject and the sender's mail that I haven't put up for privacy reasons):
body="Some body"
subject="Some Subject"
email = user.email # user.email returns a valid email address
mail.send_mail('something@myappid.appspotmail.com', email, subject, body)
The code executes without Exception, my App Engine Quota for calls to the Mail API increases, as does the quota for the number of emails sent, indicating a successful email send. However, when I check my mail, I do not get the email.
I've tried changing the subject, body, sender email etc. but whether or not I receive the mail seems totally random - I receive it sometimes (rarely) and don't at other times. The mails aren't even there in my spam folder.
What's going on? And how do I ensure that the mail is received each time?
For the 2nd question: you can't ensure the messages are received (without an additional extra receipt acknowledging service - a different beast), you can, at best, detect if they are passed successfully to the mail sending infrastructure or not. See also mail.send() feature in web2py for bounced email/ email address that doesnt exist.