Skip to main content

Messages

Send email messages to your users with a single command.

info

This function will only work with verified users in your project.

info

The email will be sent from <subdomain>@abstra-notifications.com. You might want to whitelist this domain to avoid the email being marked as spam.

info

The maximum email size is 40MB, which includes attachments, headers, subject, and recipients.

Examples

Single recipient with subject

from abstra.messages import send_email

send_email("michael.scott@dundermifflin.com", title="Toby is back", message="No god please no")

Multiple recipients

from abstra.messages import send_email

to = [
"dwight.schrute@dundermifflin.com",
"jim.halpert@dundermifflin.com",
"pam.beesly@dundermifflin.com"
]
send_email(to, message="Hello everyone!")

Multiple attachments

from abstra.messages import send_email

file_paths = [
"firstfile.pdf",
"secondfile.json",
"../thirdfile.txt"
]

to = "dwight.schrute@dundermifflin.com"

send_email(to, message="Take a look at this files!", attachments=file_paths)

Parameters

ParameterTypeDescription
tostr | list[str]The email addresses of the recipients.
messagestrThe message you want to send to the recipients.
titleoptional[str]The subject of email to be sent to the recipients
attachmentslist[str | io.IOBase]The path of the files or the loaded files you want to send to the recipients