trytond.sendmail.sendmail_transactional(from_addr, to_addrs, msg[, transaction[, datamanager]])

Send email message only if the current transaction is successfully committed. The required arguments are an RFC 822 from-address string, a list of RFC 822 to-address strings (a bare string will be treated as a list with 1 address), and an email message. The caller may pass a Transaction instance to join otherwise the current one will be joined. A specific data manager can be specified otherwise the default SMTPDataManager will be used for sending email.


An SMTP failure will be only logged without raising any exception.

trytond.sendmail.sendmail(from_addr, to_addrs, msg[, server])

Send email message like sendmail_transactional() but directly without caring about the transaction. The caller may pass a server instance from smtplib.

trytond.sendmail.get_smtp_server([uri[, strict]])

Return a SMTP instance from smtplib using the uri or the one defined in the email section of the configuration. If strict is True, an exception is raised if it is not possible to connect to the server.

class trytond.sendmail.SMTPDataManager([uri[, strict]])

A SMTPDataManager implements a data manager which send queued email at commit. An option optional uri can be passed to configure the SMTP connection. If strict is True, the data manager prevents the transaction if it fails to send the emails.

SMTPDataManager.put(from_addr, to_addrs, msg)

Queue the email message to send.