Expects a secret in Google Secret manager called: MAILGUN_TOKEN
.
TODO: add an option to pull the token from environment as well.
from mailer import Mailer
email = Mailer()
email.recipients = ["[email protected]", "[email protected]"]
email.subject = "This is the subject line"
email.send_message("This is a test message")
from mailer import Mailer
email = Mailer()
email.recipients = ["[email protected]", "[email protected]"]
email.subject = "This is the subject line"
html = """
<html>
<p> Dear Recipient,</p>
<br>
<p>This is a <strong>very important</strong> message.</p>
</html>
"""
email.send_html(html)
from mailer import Mailer
email = Mailer()
email.recipients = ["[email protected]", "[email protected]"]
email.cc = ["[email protected]"]
email.subject = "This is the subject line"
email.template = "mailgun_template_name"
email.template_vars = {
"template_var1": "value1",
"template_var2": "value2",
}
email.send_template()
from mailer import Mailer
email = Mailer()
email.recipients = ["[email protected]", "[email protected]"]
email.subject = "This is the subject line"
email.files(filepaths=["path_to_file/file_name.pdf"])
email.send_message("This is a test message")