Forums

Web2Py cannot send emails (gmail) any more (free user)

[admin update 2013-10-28: see the wiki section on email/smtp]

I am testing/developing a website using webp2y on a free account for now. Up until recently (I only found out today), sending emails from web2py worked fine. However, whenever I try to send an email now, I get:

Mail.send failure:[Errno 101] Network is unreachable

The last email I successfully sent was on July 2 (but I haven't been working on it until today - July 25). Any ideas? I haven't changed any settings. Thanks.

If you're sending the email by directly contacting a remote SMTP server then you won't be able to do that on a free account. The one exception, I believe, is Gmail - you can connect to their SMTP servers even on a free account.

If you're attempting to use your own SMTP server to send emails out (which I would recommend - many mail servers are starting to distrust connections from hosts they don't recognise as other mail servers) then again, you'll have to use Gmail from a free account. Paid accounts should be able to connect out without restriction.

If you are using Gmail, it's possible the firewall rules which allow it need updating by the PA devs, but please confirm either way first so they know whether they should be looking into it.

IIRC gmail changes the ip of its smtp server from time-to-time. I suspect that this is what's happened and that the devs need to change the firewall rules. (I would have thought a simple script, using dig, could make sure that the firewall was automatically updated.)

Yup, the firewall rules needed updating -- I've just run the script and it should work now.

@rcs1000 unfortunately it's not something we can do a simple script for, as it interacts with the rules required to handle the looser rules for paying customers.

Thanks for the replies. I am still getting the same error and no emails are getting sent. I am using gmail.

To provide you with more info, here are my Mail settings (actual username/password were changed, obviously, but I am certain that they are correct):

mail = auth.settings.mailer mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = 'username@gmail.com' mail.settings.login = 'username:password'

Giles, it seems what whatever script magic you performed did not work or there is something else at play (or gmail changed their IPs again). Thanks for the help.

I think they might have changed it again :-(

Could you give it another go?

I tested it again just now (July 29 9:15am GMT) and still nothing. Same error. Thanks for your effort. I wonder if there is a way to make the approach IP independent to avoid having to run your scripts all the time...

Packet filtering always happens on IP addresses. I've just added the current SMTP and IMAP servers for gmail to the filter rules. For direct access to them on a permanent basis you could always upgrade to a paid account since they skip the filtering.

Ok, this seems to have fixed it (at least for now :) ) and I am able to send emails again. I will let you know if anything else pops up. Thanks for the help everyone.

I can only send one email and then I get [Errno 101] Network is unreachable.

I am using Gmail's smtp server.

It would be nice if PA manages to fix that firewall issue soon!

Same problem, I'm unable to send emails with gmail smtp Could you please confirm if the problem is fixed for paying customers?

Thank you

Paid accounts don't have filtered internet access. We only introduced filtering for free accounts because people were using us to spam and or DDOS other sites. We offer a no quibble refund process so you can just try it and see.

The error "Mail.send failure:[Errno 101] Network is unreachable" is the default comportement with gmail smtp and free account or a fix can be apply? Currently I can send some mail but generaly I got Error 101.

Looks like gmail changed their ip addresses. I have updated the rules.