from gluon.tool import Mail should be from gluon.tools import Mail On 4月8日, 下午9时38分, kike <eacarm...@estudiantes.uci.cu> wrote: > I have a problem with the function Mail, when I used it the send me > the following error: > > Traceback (most recent call last): > File "/home/kike/web2py/gluon/restricted.py", line 173, in > restricted > File "/home/kike/Desktop/web2py/applications/pruebaCorreo/ > controllers/default.py", line 22, in <module> > File "/home/kike/web2py/gluon/globals.py", line 96, in <lambda> > File "/home/kike/Desktop/web2py/applications/pruebaCorreo/ > controllers/default.py", line 9, in index > from gluon.tool import Mail > ImportError: No module named tool > > and this is my code: > > def index(): > > form=SQLFORM(db.message,fields=['your_name','your_email','your_message']) > if form.accepts(request.vars,session): > asunto='cfgroup message from '+form.vars.your_name > from gluon.tool import Mail > mail=Mail(globals()) > mail.setting.server='smtp.###.###:##' > mail.setting.sender='l...@lala.lala' > mail.setting.login='lala:lala' > contexto=form.vars.your_name > mensaje=response.render(form.vars.your_message,contexto) > > mail.send(to=[form.vars.your_email],subject=asunto,message=mensaje) > response.flash='mensaje mandado!' > elif form.errors: > response.flash='please check the form and try again' > return dict(top_message=TOP_MESSAGE,form=form)
-- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.