pardon, not sure, i got what do you mean, here is the code of the message store (db.mail_queue and the full templates views) *models/db.py* db.define_table('mail_queue', Field('mail_to', 'list:string'), Field('subject'), Field('messages', 'text'), Field('status'), format = lambda r: '%s - %s - %s' % (r.mail_to, r.subject, r.status) ) db.mail_queue.messages.represent = lambda value, field: XML(value, sanitize = True, permitted_tags = ['html', 'head', 'style', 'body', 'table', 'tbody', 'th', 'tr', 'td', 'div', 'a', 'b', 'pre', 'h1', 'br/', 'img/', '<!--', '!--', '--'], allowed_attributes = {'table':['id'] } ) if value else ''
def __after_insert_test(f, id): row_test = db(db.test.id == id).iterselect().first() mail_to = f['email'] subject = 'Data test Created' messages = response.render('templates/mail/test_1.html', dict(row_test = row_test) ) db.mail_queue.insert(mail_to = mail_to, subject = subject, messages = messages) db.define_table('test', Field('first_name'), Field('last_name'), Field('email', 'list:string'), format = lambda r: '%s %s' % (r.first_name, r.last_name) ) db.test._after_insert.append(__after_insert_test) *views/templates/mail/test_1.html* <html> <head> {{include 'templates/style/report.html'}} </head> <body> Dear {{=row_test.first_name}} {{=row_test.last_name}}, {{=BR() }} <div id = 'title'>{{=H1(B(T('Test') ) ) }}</div> {{=BR() }} <table id = 'header-left'> <tbody> <tr> <td>{{=DIV(T('Name') ) }} </td> <td>: </td> <td>{{=DIV('%s %s' % (row_test.first_name, row_test.last_name) ) }} </td> </tr> <!-- </tbody> </table> <table id = 'header-right'> <tbody> --> <tr> <td>{{=DIV(T('Email') ) }} </td> <td>: </td> <td>{{=DIV(', '.join(row_test.email) ) }} </td> </tr> </tbody> </table> {{=BR() }} </body> </html> *views/templates/style/report.html* <style> * { font-family: "Lucida Console", "Lucida Sans Typewriter", "Lucida Typewriter", monospace; letter-spacing: 1px; line-height: 120%; margin: 0; padding: 0; } body { font-size: medium; font-weight: bold; width: 100%; } table { font-size: medium; font-weight: bold; width: 100%; } .text-center { text-align: center; } .text-right { text-align: right; } .black { color: black; } .blue { color: blue; } .green { color: green; } .orange { color: orange; } .darkorange { color: darkorange; } .orangered { color: orangered; } .red { color: red; } #title { text-align: center; font-weight: bold; } #header-left { float: left; width: 50%; } #header-right { float: right; width: 50%; } .detail { border-spacing: 0px; width: 100%; } .border { border-collapse: separate; border : 1px solid black; padding: 0px 5px; } </style> thanks and best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.