i am trying to create a form in web2py which sends message to an email account on submission mainly i used SQLFORM.factory to create the form then i used gluon.tools import mai
Before using mail.send() I would recommend to test if mail is correctly set :
if form.process().accepted:
session.name = form.vars.name
session.email = form.vars.email
session.subject = form.vars.subject
session.message = form.vars.message
if mail:
if mail.send(to=['otheremail@yahoo.com'],
subject='project minerva',
message= "Hello this is an email send from minerva.com from contact us form.\nName:"+ session.name+" \nEmail : " + session.email +"\nSubject : "+session.subject +"\nMessage : "+session.message+ ".\n "
):
response.flash = 'email sent sucessfully.'
else:
response.flash = 'fail to send email sorry!'
else:
response.flash = 'Unable to send the email : email parameters not defined'
elif form.errors:
response.flash='form has errors.'
Then try to change :
mail.settings.server = 'smtp@gmail.com:465'
in
mail.settings.server = 'smtp.gmail.com:465'
or
mail.settings.server = 'smtp.gmail.com:587'