Problem enabling Email services

57 views
Skip to first unread message

Sandeep Patel

unread,
Dec 7, 2017, 1:44:07 AM12/7/17
to web2py-users

Hello
I am trying to send a welcome message to user as an email. To achieve this, I have followed all the steps as they are described in the official documentation. Additionally all the settings that I have adopted for the purported functionality, can be found in the trailing email thread. However, I am still receiving an Error Message - WARNING:web2py:email not send. Can anyone help me out here please? Any help would be greatly appreciated.

Thanks
Sandeep
-----------------------------------------------
from: patelsa...@gmail.com
to: san...@robodia.com
subject: welcome

welcome to web2py

---------------------------------------------
-


In My private/appconfig.ini
[smtp]
server = smtp.gmail.com:587
sender = patelsa...@gmail.com
login  = patelsa...@gmail.com:*********

# IN db.py
mail = auth.settings.mailer
mail.settings.server = 'logging' if request.is_local else myconf.take('smtp.server')
mail.settings.sender = myconf.take('smtp.sender')
mail.settings.login = myconf.take('smtp.login')
mail.settings.tls = myconf.take('smtp.tls') or False
mail.settings.ssl = myconf.take('smtp.ssl') or False

# -------------------------------------------------------------------------
# configure auth policy
# -------------------------------------------------------------------------
auth.settings.registration_requires_verification = True
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True

# In my controller file
def form():
    form = SQLFORM.factory(
        Field('Frist_Name',type='string',requires=IS_NOT_EMPTY(),label=T('Your First Name')),
        Field('Last_Name',type='string',requires=IS_NOT_EMPTY(), label=T('Your Last Name')),
        Field('email',type='string',requires=IS_EMAIL(), label=T('Your Email Address')),
        Field('password',type='password',requires = [IS_STRONG(),CRYPT(key='sha512:thisisthekey')],label=T('password')),
        Field('confirm_password',type='password',requires=IS_EQUAL_TO(request.vars.password),label=T('confirm-password')),
        Field('Gender',type='string', requires=IS_IN_SET(['male','female ']),label=T('Your Sex')))
    if form.process().accepted:
        if mail:
            if mail.send(to=['san...@robodia.com'], subject='welcome', message='welcome to web2py'):
                    response.flash = T('mail sand successful')
            else :
                response.flash = T('mail not send')
        else :
            response.flase = T('unable o send mail')
    elif form.errors:
        response.flase = 'form error'
    return locals()

Dave S

unread,
Dec 7, 2017, 3:20:37 PM12/7/17
to web2py-users


On Wednesday, December 6, 2017 at 10:44:07 PM UTC-8, Sandeep Patel wrote:

Hello
I am trying to send a welcome message to user as an email. To achieve this, I have followed all the steps as they are described in the official documentation. Additionally all the settings that I have adopted for the purported functionality, can be found in the trailing email thread. However, I am still receiving an Error Message - WARNING:web2py:email not send. Can anyone help me out here please? Any help would be greatly appreciated.

Thanks
Sandeep
 
[...]

In My private/appconfig.ini
[smtp]
server = smtp.gmail.com:587

Is GMail's 2-factor authentication getting in the way here?  IIRC (from previous posters), the way around that involves registering your app with Google.  Others prefer to use other mailer services.  My AWS instance runs sendmail, so I have a local mailer, but had to SPF and DMARC stuff in the DNS records.

/dps


 
Reply all
Reply to author
Forward
0 new messages