my app work, but don't send the email, it send me a message tell me it
work sucesfull, but don't send the email.

here is my code

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.tools import Mail
       mail=Mail(globals())
       mail.settings.server='smtp.###.###:##'
       mail.settings.sender='l...@lala.lala'
       mail.settings.login='lala:lala'

mail.send(to=[form.vars.your_email],subject=asunto,message=form.vars.your_message)
       response.flash='mensaje mandado!'
    elif form.errors:
       response.flash='please check the form and try again'
    return dict(top_message=TOP_MESSAGE,form=form)

What is the problem??


On Apr 8, 9:57 am, kike <eacarm...@estudiantes.uci.cu> wrote:
> thank friend, I follow the example in the web2py book, and in that is
> wrote from gluon.tool import Mail
>
> On Apr 8, 9:41 am, hywang <why00...@163.com> wrote:
>
> >   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.

Reply via email to