Unable to send email on server in web2py.....

1,375 views
Skip to first unread message

Akash Agrawall

unread,
Jan 4, 2014, 3:40:11 AM1/4/14
to web...@googlegroups.com
Hie folks.. I know this question is already been asked but I didn't get any help from those answers..... please hava look at this....
I am unable to send email in server(to be specific webfaction.com) ...
but it's running fine on local host
all these three lines in db.py are set to true.
auth.settings.registration_requires_verification = True
auth.settings.registration_requires_approval = True auth.settings.reset_password_requires_verification = True

When I complete the registration form a flash appears on the top-right corner of the page with a flash message "Unable to send mail"
These are the settings of the mail server in db.py

mail = auth.settings.mailer
mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = 'fakeid...@gmail.com'
mail.settings.tls = False
mail.settings.login ='fakeid...@gmail.com:secret'


Alan Etkin

unread,
Jan 4, 2014, 7:27:37 AM1/4/14
to web...@googlegroups.com
Hie folks.. I know this question is already been asked but I didn't get any help from those answers..... please hava look at this....
I am unable to send email in server(to be specific webfaction.com) ...
but it's running fine on local host

Akash Agrawall

unread,
Jan 5, 2014, 4:10:45 AM1/5/14
to web...@googlegroups.com
Sorry for late reply man..... I checked the same.... no luck in that... !! :(
my present code....
from gluon.tools import Mail
mail = Mail()
#mail = auth.settings.mailer
mail.settings.server =  'localhost'
mail.settings.sender = 'fakeid...@gmail.com'
mail.settings.tls = None
mail.settings.login = None

same flash message in there.....

Alan Etkin

unread,
Jan 5, 2014, 2:56:06 PM1/5/14
to web...@googlegroups.com
Sorry for late reply man..... I checked the same.... no luck in that... !! :(

Please post the output of mail.result and mail.error after the call to .send()

Akash Agrawall

unread,
Jan 6, 2014, 4:00:52 AM1/6/14
to web...@googlegroups.com
{} (534, '5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtQh\n5.7.14 wnWg7iNJ76cQ-TNYHbtQ4Ow5zf3X78ZYd_hWCz-uLz6p26qOHkaLNwiHYAacQbCgpsTo8N\n5.7.14 jovPqLm6zPKwliPF7LV0Ods2eHGtAOyMq6tvuceciSmNFYaNaMF6ZmW3zhB5u4us_dAx0I\n5.7.14 NHzBmG5CGtHpEWBgLHx3NOC35I2gLQUppirDJCz1Eb71V0VrFyDi0pP78TokTAkQmaeswq\n5.7.14 Sv3YLkA> Please log in via your web browser and then try again.\n5.7.14 Learn more at https://support.google.com/mail/bin/answer.py?answer=787\n5.7.14 54 k3sm18085214yhc.13 - gsmtp')


On Mon, Jan 6, 2014 at 1:26 AM, Alan Etkin <spam...@gmail.com> wrote:
Sorry for late reply man..... I checked the same.... no luck in that... !! :(

Please post the output of mail.result and mail.error after the call to .send()

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/CU_1qWYixjI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
akash.wanteds

Tim Richardson

unread,
Jan 6, 2014, 9:00:11 AM1/6/14
to web...@googlegroups.com
Gmail probably requires a secure connection so your tls setting may be wrong

黄祥

unread,
Jan 6, 2014, 9:25:39 AM1/6/14
to web...@googlegroups.com
please try this on your models.

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

best regards,
stifan

Akash Agrawall

unread,
Jan 6, 2014, 10:26:48 AM1/6/14
to web...@googlegroups.com
Still same error..... it's too urgent for me....
you didn't mention anything about mail.settings.tls...
I tried all three combinations
1. commenting it out
2. keeping it false
3. keeping it true

still same output (a flash message showing "unable to send mail")


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/CU_1qWYixjI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
akash.wanteds

Alan Etkin

unread,
Jan 6, 2014, 5:47:47 PM1/6/14
to web...@googlegroups.com
El lunes, 6 de enero de 2014 12:26:48 UTC-3, Akash Agrawall escribió:
Still same error..... it's too urgent for me....

It appears gmail is using some sort of smtp service lock for your application account:

http://designoservices.com/smtp-error-534-5-7-14-54-sending-mail-through-cake-or-php-using-gmail-account/
http://stackoverflow.com/questions/17462380/server-send-emails-using-gmail-smtp-gets-alerts
http://webapps.stackexchange.com/questions/44768/limitations-on-sending-email-through-gmail-smtp

According to the first post, it is resolved by just "... logging into your gmail and verifying its identity ..."

Cliff Kachinske

unread,
Jan 6, 2014, 6:04:06 PM1/6/14
to web...@googlegroups.com
On webfaction you can set up an email account and access it directly from within web2py, thus eliminating the transmission to gmail.

NeoToren

unread,
Jan 21, 2014, 4:13:12 PM1/21/14
to web...@googlegroups.com
Hello,

I have had the same issue trying to send email using Web2Py server.
This is not  mere luxury, emails are needed for a robust authentication process which Web2Py offers, IF one can send emails from W2P...

Seems the problem is with GMAIL as other have noted before, on this and on other blogs.
I have tried all the possible combinations of port with TLS and etc...

Nothing worked and some combinations actually caused Web2Py server to crash...

Eventually - went to https://mandrillapp.com/ and got SMTP service (for free).
It takes literally 5 minutes to register with these guys get SMTP definitions that you can then use in Web2Py  and it works !!!

Disclaimer - I have nothing to do with this company mandrillapp. I have actually got the name from one of the links that Alan Etkin has posted a few days ago.
Hope it helps

Akash Agrawall

unread,
Jan 22, 2014, 9:00:35 AM1/22/14
to web...@googlegroups.com
Can you explain it in a more brief way. Like where are you hosting the site and which site you are using to send the mail from(like gmail, yahoo or ??) and please fill in the mail settings(in db.py) that you have used to make it work.
In my case the case was that the server was from US and gmail has some kind of firewall to disable requests from this area. Finally I used the email of the site itself which allowed me to host and the mail settings was given by the site people themself...

Regards,
Akash


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/CU_1qWYixjI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
akash.wanteds

NeoToren

unread,
Jan 22, 2014, 4:12:14 PM1/22/14
to web...@googlegroups.com
Not hosting it yet, still building and testing...
I have tried to use gmail (I am located in USA) and had encountered same problems you and others did. 
Since I am not hosted YET, and for testing purposes I needed be able to send email I decided to go with this company I found yesterday...
In this regard it seems like the same solution you found when you mentioned "the mail settings was given by the site people themself... "

The Web2Py book on this subject is correct - it just doesn't work with gmail as SMTP.

This is what I have in my db.py and it works:

##configure email 
from gluon.tools import Mail
mail=auth.settings.mailer
mail.settings.server ='smtp.mandrillapp.com:587' # this is the SMTP and port
mail.settings.sender = 'mya...@gmail.com' # note that a gmail adrs CAN BE USED as sender 
mail.settings.login = 'mya...@gmail.com:pwdYouGonnaGetFromMandrillapp'

Take care,
NeoToren
Reply all
Reply to author
Forward
0 new messages