Your email should begin with <html> tag and end with </html>. If you have anything before/after, it will not render.
Marin On Sun, Sep 23, 2012 at 9:05 PM, Pystar <aitoehi...@gmail.com> wrote: > Using this method, the mail is sent successfully,but shows raw html code > in the email client, i.e. its not rendering > > > On Friday, September 7, 2012 4:19:45 PM UTC+1, Niphlod wrote: >> >> it's a path relative to the app's *views *folder. With this code your * >> message.html* should be next to layout.html, just in the >> *yourapp/views/*folder. >> >> Il giorno venerdì 7 settembre 2012 17:04:27 UTC+2, Daniel Gonzalez ha >> scritto: >>> >>> As explained here: >>> >>> http://web2py.com/books/**default/chapter/29/8#Using-** >>> the-template-system-to-**generate-messages<http://web2py.com/books/default/chapter/29/8#Using-the-template-system-to-generate-messages> >>> >>> The following code can be used to render a view file to send via email: >>> >>> for person in db(db.person).select(): >>> context = dict(person=person) >>> message = response.render('message.html'**, context) >>> mail.send(to=['w...@example.**com'], >>> subject='None', >>> message=message) >>> >>> I have tried this, but I am not able to place the "message.html" >>> correctly in the directory hierarchy. >>> How does reponse.render find the view files, or, even better, how can I >>> tell response.render where to find my template file? >>> >>> Thanks, >>> Daniel >>> >> -- > > > > --