This does not look right mail.settings.server = 's...@gmail.com:465'
perhaps should be mail.settings.server = 'smtp.gmail.com:465 <http://s...@gmail.com:465/>' On Sunday, 29 September 2013 23:29:58 UTC-5, deepak sandhu wrote: > > 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 mail to import the send email functionality. i have > set up everything i can think of but still on running this code in web2py it > gives out that "fail to send email sorry". > > i think the problem is in smtp setting or something. > > > from gluon.tools import Mail > mail = Mail() > > mail.settings.server = 's...@gmail.com:465' > mail.settings.sender = 'mye...@gmail.com <javascript:>' > mail.settings.login = 'myem...@gmail.com:secret' > > > > def index(): > > form = SQLFORM.factory( > Field('name', requires=IS_NOT_EMPTY()), > Field('email', requires =[ IS_EMAIL(error_message='invalid email!'), > IS_NOT_EMPTY() ]), > Field('subject', requires=IS_NOT_EMPTY()), > Field('message', requires=IS_NOT_EMPTY(), type='text') > ) > if form.process().accepted: > session.name = form.vars.name > session.email = form.vars.email > session.subject = form.vars.subject > session.message = form.vars.message > > x = mail.send(to=['other...@yahoo.com <javascript:>'], > 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 " > ) > > if x == True: > response.flash = 'email sent sucessfully.' > else: > response.flash = 'fail to send email sorry!' > > #response.flash = 'form accepted.' > elif form.errors: > response.flash='form has errors.' > > return dict(form=form) > > -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.