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.comto:
san...@robodia.comsubject: welcome
welcome to web2py
---------------------------------------------
-
In My private/appconfig.ini
[smtp]
server =
smtp.gmail.com:587sender =
patelsa...@gmail.comlogin = 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()