Wrapper on the email module. Email object represents emails to be sent to the client. Also provides a clean way to add binary FileData attachments
Email with attachments:
# get attachments
al = sql('select file_list from `tab%s` where name="%s"' % (dt, dn))
if al:
al = al[0][0].split('\n')
# create the object
email = server.EMail('test@webnotestech.com', ['a@webnotestech.com', 'b@webnotestech.com'], 'this is a test')
# add some intro
email.set_message(replace_newlines('Hi\n\nYou are being sent %s %s\n\nThanks' % dt, dn))
# add attachments
for a in al:
email.attach(a.split(',')[0])
# send
email.send()