zoom.mail module

zoom.mail

email services

zoom.mail.send(recipients, subject, message, attachments=None)

send an email

>>> zoom.system.site = zoom.sites.Site()
>>> send('joe@testco.com', "test", "This is a test")
zoom.mail.send_as(sender, recipients, subject, message, attachments=None)

send an email as a specific sender

>>> zoom.system.site = zoom.sites.Site()
>>> send_as('a-user@testco.com', 'joe@testco.com', "test", "This is a test")

This function compares the sender to the default send_from information configured for the site, and if they differ it includes a Reply-To header in the email message.

NOTE: Some email providers may flag emails sent using the reply-to header as spam or phishing emails. To send email reliably when the domains of the site send_from address differ from the reply-to address domain the system must be configured properly. There is much written on this topic so we don’t try to cover it here, however here is a useful place to start:

zoom.mail.deliver()

deliver mail

class zoom.mail.Attachment(pathname, data=None, mime_type=None)

Bases: object

Email attachment

provide either a pathname, or a filename and a pathname, or if sending directly a filename and a file-like object.

as_tuple()

partilars required for delivery

read

provides a reader for the data

if the data is not open, it will be because the user provided only a pathanme so we open the file at the pathname and return it