This is my code: 

from gluon.tools import Mail
mail = Mail()
mail.settings.server = 'smtp.gmail.com:465'
mail.settings.sender = '[email protected]'
mail.settings.login = 'sending-email:password'
mail.settings.ssl = True
mail.settings.tls = True


@auth.requires_signature()
def send_contact_form():
    x = mail.send(to=['[email protected]'],
              subject='Test',
              message="Test Message")
    if x == True:
        print "Email sent successfully"
    else:
        print "Nope"
    print x
    print mail.result
    print mail.error

    return 'ok'


The sending email is an email address that I have had for many years. It 
doesn't have any 2 step-verification on it, access for less secure apps has 
been turned on, and both POP and IMAP is enabled for it. I've tried connecting 
to ports 25, 465, 587, and 993 with no success. 

I have tried everything on Google's SMTP setup pag 
<https://support.google.com/a/answer/176600?hl=en>e, but nothing has worked. 


Errors I get when using 'smtp.gmail.com:25':

Nope
WARNING:web2py:Mail.send failure:[Errno 10060] A connection attempt failed 
because the connected party did not properly respond after a period of time, or 
established connection failed because connected host has failed to respond
False
{}
[Errno 10060] A connection attempt failed because the connected party did not 
properly respond after a period of time, or established connection failed 
because connected host has failed to respond


Errors I get when using 'smtp.gmail.com:465':

Nope
False
{}
(534, '5.7.14 
<https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbuD\n5.7.14 
WXRGlkuzK7dK0d0H9cK3MaCX62ZEQzxju19EBPw67c-uTyKzhSEhIjM50JOVS3OKGtJV63\n5.7.14 
d2F2kbtxaNWRP_plb2zF2VHwDNjrot97Jckf0f5VZy7iorl9s08WANnni-J_TR1F2L3xcM\n5.7.14 
fX9PHbhrDZJRULhHZAnaXSd_kOHhCqXyY5OS-V4oKbMneApZ4fYcib85z-8OBWEuTbeVsa\n5.7.14 
M1RU0KRCFbu8ro5uTv-kQIGkgMKA8> Please log in via your web browser and\n5.7.14 
then try again.\n5.7.14  Learn more at\n5.7.14  
https://support.google.com/mail/answer/78754 x5sm4457200pax.33 - gsmtp')
WARNING:web2py:Mail.send failure:(534, '5.7.14 
<https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbuD\n5.7.14 
WXRGlkuzK7dK0d0H9cK3MaCX62ZEQzxju19EBPw67c-uTyKzhSEhIjM50JOVS3OKGtJV63\n5.7.14 
d2F2kbtxaNWRP_plb2zF2VHwDNjrot97Jckf0f5VZy7iorl9s08WANnni-J_TR1F2L3xcM\n5.7.14 
fX9PHbhrDZJRULhHZAnaXSd_kOHhCqXyY5OS-V4oKbMneApZ4fYcib85z-8OBWEuTbeVsa\n5.7.14 
M1RU0KRCFbu8ro5uTv-kQIGkgMKA8> Please log in via your web browser and\n5.7.14 
then try again.\n5.7.14  Learn more at\n5.7.14  
https://support.google.com/mail/answer/78754 x5sm4457200pax.33 - gsmtp')


Errors I get when using 'smtp.gmail.com:587':

WARNING:web2py:Mail.send failure:[SSL: UNKNOWN_PROTOCOL] unknown protocol 
(_ssl.c:590)
Nope
False
{}
[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)


Errors I get when using 'smtp.gmail.com:993':

WARNING:web2py:Mail.send failure:(-1, 'Gimap ready for requests from 
50.150.125.89 py13mb358160253pab')
Nope
False
{}
(-1, 'Gimap ready for requests from 50.150.125.89 py13mb358160253pab')


Sorry for the long errors, but I can't see what I'm doing wrong.


-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to