I'm using web2py 2.22.3. My only email settings in db.py are are:
## configure email
mail=auth.settings.mailer
mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = '********@gmail.com'
mail.settings.login = '********@gmail.com:################'
The length 16 password is the app password generated by gmail. Emails work,
used mainly by auth to send
reset-password links.
Here's a little python snippet to test your userid / password work with
gmail.
import imaplib
import sys
def checkGmail(userid, password):
'''
get unread email count and spam count from gmail
'''
try:
session = imaplib.IMAP4_SSL('imap.gmail.com')
session.login(userid, password)
session.select()
unseen_inbox = len(session.search(None, 'UNSEEN')[1][0].split())
rc = session.select('[Gmail]/Spam')
if rc[0] == 'OK':
spam = int(rc[1][0])
else:
spam = '0'
return(True, unseen_inbox, spam)
except:
print(("Unexpected error:", sys.exc_info()))
return (False,)
if __name__ == '__main__':
print (checkGmail('**********@gmail.com', '################'))
When I run this with the userid and password set in my db.py file I
get (True, 30, 5), demonstrating that I can log in to gmail with the userid
and app password. Does it work for you?
On Thursday, 18 August 2022 at 03:07:40 UTC+1 lucas wrote:
> i am using web2py 2.22.5 using the wsgihandler.py handler and nginx under
> centos 8 stream all current and updated and rebooted. i don't understand
> all of the stuff from massimo
>
> On Wednesday, August 17, 2022 at 8:54:22 PM UTC-4 lucas wrote:
>
>> i'm wondering. do i have to retrieve or generate the 16 digit password
>> from the app itself. cuz i don't know how to do that since it is purely a
>> linux console only interface.
>>
>> On Wednesday, August 17, 2022 at 12:18:16 PM UTC-4 lucas wrote:
>>
>>> nope, and i regenerated a new password just to be sure and restarted the
>>> server daemons also. just in case appconfig is only loaded once.
>>>
>>>
>>> On Wednesday, August 17, 2022 at 12:15:52 PM UTC-4 Clemens wrote:
>>>
>>>> Hmmmmm, one last guess: ssl false, tls true and port 587.
>>>>
>>>> On Wednesday, August 17, 2022 at 6:12:50 PM UTC+2 lucas wrote:
>>>>
>>>>> nope, that didn't work either. uhmmmmm.
>>>>>
>>>>> On Wednesday, August 17, 2022 at 12:08:12 PM UTC-4 Clemens wrote:
>>>>>
>>>>>> Hmm, should work, since it's the right port for ssl. Maybe setting
>>>>>> tls to false could make it work, since the tls port is 587.
>>>>>>
>>>>>> Have a try! Hope it helps!
>>>>>>
>>>>>> Clemens
>>>>>>
>>>>>> On Wednesday, August 17, 2022 at 5:57:56 PM UTC+2 lucas wrote:
>>>>>>
>>>>>>> oh, so the latter is still not sending the Lost Password.
>>>>>>>
>>>>>>> On Wednesday, August 17, 2022 at 11:54:38 AM UTC-4 lucas wrote:
>>>>>>>
>>>>>>>> ok, i turned on 2-step verification, generated 1 password for "App
>>>>>>>> passwords" that gave me a 16 character string which i copied into the
>>>>>>>> password location under private/appconfig.ini:
>>>>>>>>
>>>>>>>> server = smtp.gmail.com:465
>>>>>>>> sender = [email protected]
>>>>>>>> login = '[email protected]:eakwlqljrsdeyj16'
>>>>>>>> tls = true
>>>>>>>> ssl = true
>>>>>>>>
>>>>>>>> where i changed the login string so i didn't give away my
>>>>>>>> security. so what do you think?
>>>>>>>> lucas
>>>>>>>>
>>>>>>>> On Wednesday, August 17, 2022 at 11:34:58 AM UTC-4 Clemens wrote:
>>>>>>>>
>>>>>>>>> Generate an app password, as follows:
>>>>>>>>> https://support.google.com/mail/answer/185833?hl=en
>>>>>>>>>
>>>>>>>>> This should solve it, hopefully.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> Clemens
>>>>>>>>>
>>>>>>>>> On Wednesday, August 17, 2022 at 5:20:49 PM UTC+2 lucas wrote:
>>>>>>>>>
>>>>>>>>>> hey one and all,
>>>>>>>>>>
>>>>>>>>>> on May 5th, 2022, gmail imposed the 2 step verification on its
>>>>>>>>>> smtp service. how do we configure web2py to still use our gmail
>>>>>>>>>> accounts
>>>>>>>>>> to send smtp for password retrieval.
>>>>>>>>>>
>>>>>>>>>> thank you in advance, lucas
>>>>>>>>>>
>>>>>>>>>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/6fea335e-a601-4010-af2e-d30f41645ce9n%40googlegroups.com.