email not sent

681 views
Skip to first unread message

Alex Glaros

unread,
Aug 17, 2014, 1:50:05 AM8/17/14
to web...@googlegroups.com
on PythonAnywhere, I get "email not sent error"

did I do anything wrong?

## configure email
mail = auth.settings.mailer
mail.settings.server = 'logging' or 'smtp.gmail.com:587'
mail.settings.sender = 'al...@gmail.com'         # your email

2014-08-17 04:51:36,559 :email not sent
----------------------------------------
From: a...@gmail.com
To: a...@gmail.com
Subject: Password reset

Click on the link https://alexglaros.pythonanywhere.com/engagementSquared/default/user/reset_password/140 to reset your password
----------------------------------------

2014-08-17 04:48:48 announcing my loyalty to the Emperor...
2014-08-17 04:51:36 WARNING:web2py:email not sent#012----------------------------------------#012From: ale...@gmail.com#012To: al...@gmail.com#012Subject: Password reset#012#012Click on the link https://alexglaros.pythonanywhere.com/engagementSquared/default/user/reset_password9ce8cd5 to reset your password#012----------------------------------------

thanks,

Alex Glaros

lyn2py

unread,
Aug 17, 2014, 2:32:55 AM8/17/14
to web...@googlegroups.com
Yup, you need to change "logging" to the smtp gmail server, in other words, switch them around (put the smtp first followed by logging).

Logging will print the email in the console, which you can use to check the contents.

Massimo Di Pierro

unread,
Aug 17, 2014, 2:34:24 AM8/17/14
to web...@googlegroups.com

mail.settings.server = 'logging'

only logs but does not send emails.
PythonAnywhere does not run any smtp server so you have to use an external one for example gmail:

mail.settings.server = 'smtp.gmail.com:587'

You need to configure that with your username and password. You also have to tell gmail to allow your app to connect to it via smtp.

Alex Glaros

unread,
Aug 17, 2014, 3:02:52 AM8/17/14
to
I switched "logging" around and received this from Google.  How do I let Google know not to block?  thanks, Alex

Hi Alex,

Someone recently used your password to try to sign in to your Google Accountalexglaros@gmail.com. This person was using an application such as an email client or mobile device.

We prevented the sign-in attempt in case this was a hijacker trying to access your account. Please review the details of the sign-in attempt:


Alex Glaros

unread,
Aug 17, 2014, 3:14:46 AM8/17/14
to web...@googlegroups.com
okay, I assured Google it was really me, now password reset seems to work

thanks folks!

Alex

Ron Chatterjee

unread,
May 15, 2017, 12:49:58 PM5/15/17
to web2py-users

I can send email locally from my desktop but I am having issues send email through python anywhere. I have the gmail set up as "allowing less secure app" and below is the set up. Any help will be much appreciated.


#-----------------------------------------------------------
in db.py I have
mail = auth.settings.mailer
mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = ''
mail.settings.login = 'rchx...@gmail.com:pas###wrd' 
#--------------------------------------------------------------------------

#----------------------------------------------------------------------------------

in apconfig.ini (don't know if it matters)

; App configuration

; db configuration
[db]
uri       = sqlite://storage.sqlite
migrate   = 1
pool_size = 1


; smtp address and credentials
[smtp]
server = smtp.gmail.com:587
sender = ''
login  = rch####2...@gmail.com:pass##wd

; general app data
[global]
owner = Me
site  = http://mysite.pythonanywhere.com/mysite/

; form styling
[forms]
formstyle = bootstrap3_inline
separator =

#-------------------------------------------------------------------------

pbreit

unread,
May 17, 2017, 12:13:10 AM5/17/17
to web2py-users
Is there some reason you are not setting "sender"?

You might need to do this:

Ron Chatterjee

unread,
May 17, 2017, 10:03:51 AM5/17/17
to web2py-users
I did all of that. Gmail is set as less secured. Here is the app and instruction to make it to work locally (local server) and also by importing to pythonanywhere where it doesn't work. 
#-----------------------------------------------------------------------------------------

Gmail is made to less secure app. 

in db.py (in attached web2py app) 
change line 74 with your own email address and password.

In default.py 
change line 16 with your own email address


finally
go to apiconfig.ini file 
and change line 14 with your gmail address and password.

Run the app, go to contact form and send a message. You should be getting an email (try this locally first) and it works fine. 

Then put this app and import to python anywhere and it breaks. Doesn't work. Email are not send.


Any thoughts?
web2py.app.email_test_in_pa.w2p

Ron Chatterjee

unread,
May 17, 2017, 3:43:42 PM5/17/17
to web2py-users
This have done the trick! thank you - PA 

https://www.google.com/accounts/DisplayUnlockCaptcha
Reply all
Reply to author
Forward
0 new messages