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 >> >> 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 >> > --