Massimo, Thanks for your explanation.
Annet. On May 27, 6:28 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > It depends on who sends the email. If an action triggered by a web > request does, then the code goes in the action. If you want a > backrgound script to send the emails then you put the code in > script.py and run it with > > web2py.py -S yourapp -M -R /path/to/your/script.py > > the context is dictionary with the variable you want to be visible. > For example > > context=dict(name="Annet") > message=parse_template('email.txt',path=path,context=context) > > --- email.txt ---- > Dear {{=name}}, > how are you today? > --- end ----- > > On May 27, 11:05 am, annet.verm...@gmail.com wrote: > > > In one of my applications I have an e-mail form, which for a lack of > > knowledge is sent to my mail box using the following code in the > > function: > > > mail.send(to=['annet.v...@gmail.com'], subject=form.vars.onderwerp, > > message=form.vars) > > > In db.py I have got: > > > from gluon.tools import Mail > > > mail=Mail() > > mail.settings.server='smtp.gmail.com:587' > > mail.settings.sender='annet.v...@gmail.com' > > mail.settings.login='annet.v...@gmail.com:**********' > > > When I want to use a template to layout the mail, where do these lines > > of code go: > > > from gluon.template import parse_template > > > path=os.path.join(request.folder,"views") > > context=dict(a=1,b=2,c=3,etc="etc") > > message=parse_template('file.html',path=path,context=context) > > mail.send(to=['....@whatever.com'],subject='None',message=message) > > > ... and what is the meaning of context=dict(...) > > > Kind regards, > > > Annet --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@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 -~----------~----~----~----~------~----~------~--~---