Mail.send failure:STARTTLS ...

614 views
Skip to first unread message

Martin Weissenboeck

unread,
Dec 28, 2010, 3:17:50 AM12/28/10
to web...@googlegroups.com
Hi,

I want my website to send emails.

I have tried (in db.py)

mail.settings.server = 'smtp.gmail.com:587'  # your SMTP server
mail.settings.sender = 'mygmail...@gmail.com'         # your email
mail.settings.login = 'mygmail...@gmail.com:mygmailpassword'    # your credentials or None

and

mail.settings.server = '127.0.0.1'  # your SMTP server
mail.settings.sender = 'off...@mydomain.com'         # your email
mail.settings.login = None    # your credentials or None

In both cases I got the message

WARNING:web2py:Mail.send failure:STARTTLS extension not supported by server.

Pure Python works fine:

# python2.7
>>> import smtplib
>>> server = smtplib.SMTP('127.0.0.1')
>>> server.sendmail('a...@test.com','mygmail...@gmail.com','test')

Operating system: CentOS

What shall I do?

With kind regards
Martin

Martin Weissenboeck

unread,
Dec 28, 2010, 11:27:11 AM12/28/10
to web...@googlegroups.com
I have found a solution:

In the file db.py I have found the following lines:
Line 37-39:

mail.settings.server = 'smtp.gmail.com:587'  # your SMTP server
mail.settings.sender = 'myqmail...@gmail.com'         # your email
mail.settings.login = 'mygmail...@gmail.com:mygmailpassword'    # your credentials or None

Line 121-123:

mail.settings.server = settings.email_sender
mail.settings.sender = settings.email_sender
mail.settings.login = settings.email_login


I do not understand what the purpose of these lines is. I have commented these lines out and now sending by Gmail works very well.

# mail.settings.server = settings.email_sender
# mail.settings.sender = settings.email_sender
# mail.settings.login = settings.email_login

And my localhost needs tls=False:

mail.settings.server = 'localhost:25'
mail.settings.sender = 'off...@mydomain.com'
mail.settings.tls = False
mail.settings.login = None

By the way: I had to change #
"Click on the link http://..." to 
"Click on the link https://..." 
(lines 88 and 93)

2010/12/28 Martin Weissenboeck <mwei...@gmail.com>
Reply all
Reply to author
Forward
0 new messages