How to debug "lost password"

77 views
Skip to first unread message

Jon Subscripted

unread,
Aug 19, 2020, 1:50:07 PM8/19/20
to web...@googlegroups.com
Hi everyone,
I'm having some trouble sending "lost password" emails to my users. Whenever I test it I get an "Unable to send email" message.

But I do not really know the reason. I tried with a standalone python script with the same configuration and it works.

I'd like to know how to debug this problem or where to look at. 

In which log are email related errors written?
Regards, Jon.

Jon Subscripted

unread,
Aug 20, 2020, 10:47:11 AM8/20/20
to web...@googlegroups.com
Any suggestions on how to debug "password lost" email not being sent.
Thanks, Jon.

Jim S

unread,
Aug 20, 2020, 7:56:17 PM8/20/20
to web2py-users
What does your mail setup in db.py look like?

-Jim

Jon Subscripted

unread,
Aug 21, 2020, 5:45:58 AM8/21/20
to web...@googlegroups.com
Hi Jim,
It looks like this (see below):

# -------------------------------------------------------------------------
# configure email
# -------------------------------------------------------------------------
mail = auth.settings.mailer
mail.settings.server = configuration.get('smtp.server') #'logging' if request.is_local else configuration.get('smtp.server')
mail.settings.sender = configuration.get('smtp.sender')
mail.settings.login = configuration.get('smtp.login')
mail.settings.tls = configuration.get('smtp.tls') or False
mail.settings.ssl = configuration.get('smtp.ssl') or False

Thanks, Jon.

--
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 web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/a61e3de4-f288-4968-9001-d21741f881f2o%40googlegroups.com.

Jon Subscripted

unread,
Aug 21, 2020, 5:51:55 AM8/21/20
to web...@googlegroups.com
Hi everyone,
Whe I run my web2py app locally (in my desktop in 127.0.0.1:8000) I get the following message:

'08/21/2020 11:48:56 AM' - web2py - WARNING - Mail.send failure:please run connect() first

What does it mean?
Thanks, Jon.

Jim S

unread,
Aug 21, 2020, 8:53:03 AM8/21/20
to web2py-users
Hey Jon, I should have been more specific.  What I was looking for was the actual server and port you're accessing for the mail server.  Looks like it is stored in your config.  Is that mail server accessible from you workstation?  Can you telnet to it using the settings in the config file?

-Jim
To unsubscribe from this group and stop receiving emails from it, send an email to web...@googlegroups.com.

Jon Subscripted

unread,
Aug 22, 2020, 4:59:09 AM8/22/20
to web...@googlegroups.com
Hi Jim,
My configuration for appconfig.ini is the following:

; smtp address and credentials
[smtp]
server = mail.xakemate.eus:25
sender = ad...@xakemate.eus
login  = ad...@xakemate.eus:*******
tls    = false
ssl    = false

When I try the following script (from my laptop) it does work.

import smtplib
import email.utils
from email.mime.text import MIMEText

def send(receiver):
    # Create the message
    msg = MIMEText('This is the body of the message.')
    msg['To'] = email.utils.formataddr(('Recipient', receiver))
    msg['From'] = email.utils.formataddr(('Author', 'ad...@xakemate.eus'))
    msg['Subject'] = 'Simple test message'


    server = smtplib.SMTP('mail.xakemate.eus',25)
    server.ehlo() # Can be omitted
    server.login('ad...@xakemate.eus', '********')
    server.set_debuglevel(True) # show communication with the server
    try:
        server.sendmail('ad...@xakemate.eus',
                        [receiver],
                        msg.as_string())
    finally:
        server.quit()



if __name__=="__main__":
    send('ad...@xakemate.eus')
   
Byt the way, should values in "appconfig.ini" be quoted? Meaning, should I use 'mail.xakemate.eus:25' or mail.xakemate.eus:25 (with no quotes)?
Thanks, Jon.

Libre de virus. www.avast.com

To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/d6644977-e184-4612-98e6-7556ef88e230o%40googlegroups.com.

Jim S

unread,
Aug 22, 2020, 10:51:47 AM8/22/20
to web2py-users
Everything there is looking just right.  The only thing you haven't shared is the mail send line in your web2py app.

I haven't used appconfig.ini so can't answer that question.  Have you tried both ways or tried coding the values directly into your python script?

-Jim

On Saturday, August 22, 2020 at 3:59:09 AM UTC-5, Jonsubs wrote:
Hi Jim,
My configuration for appconfig.ini is the following:

; smtp address and credentials
[smtp]
server = mail.xakemate.eus:25
sender = ad...@xakemate.eus
login  = ad...@xakemate.eus:*******
tls    = false
ssl    = false

When I try the following script (from my laptop) it does work.

import smtplib
import email.utils
from email.mime.text import MIMEText

def send(receiver):
    # Create the message
    msg = MIMEText('This is the body of the message.')
    msg['To'] = email.utils.formataddr(('Recipient', receiver))
    msg['From'] = email.utils.formataddr(('Author', 'ad...@xakemate.eus'))
    msg['Subject'] = 'Simple test message'


    server = smtplib.SMTP('mail.xakemate.eus',25)
    server.ehlo() # Can be omitted
    server.login('admin@xakemate.eus', '********')

    server.set_debuglevel(True) # show communication with the server
    try:
        server.sendmail('admin@xakemate.eus',

Jon Subscripted

unread,
Aug 24, 2020, 3:32:43 AM8/24/20
to web...@googlegroups.com
Hi Jim,
Actually I thought I did not need to "send" the mail myself. I thought the framework took care of it.

But I think I'll try to send the email in some part of the application to test if everything is ok. Thanks for the suggestion Jim. I'll try it and get back to you.
Thanks, Jon.

    server.login('ad...@xakemate.eus', '********')

    server.set_debuglevel(True) # show communication with the server
    try:
        server.sendmail('ad...@xakemate.eus',
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/2995b27e-4bcf-4ca3-a0b7-66ec62d53739o%40googlegroups.com.

Dave S

unread,
Aug 29, 2020, 4:59:49 AM8/29/20
to web2py-users


On Monday, August 24, 2020 at 12:32:43 AM UTC-7, Jonsubs wrote:
Hi Jim,
Actually I thought I did not need to "send" the mail myself. I thought the framework took care of it.

But I think I'll try to send the email in some part of the application to test if everything is ok. Thanks for the suggestion Jim. I'll try it and get back to you.
Thanks, Jon.


The framework needs to be told what to send, and that's what mail.send() is for.

/dps
 
    server.login('admin@xakemate.eus', '********')

    server.set_debuglevel(True) # show communication with the server
    try:
        server.sendmail('admin@xakemate.eus',
Reply all
Reply to author
Forward
0 new messages