Tussik Emailer
Easy to create or generate an email, then send it.
- Emailer
- Email Builder
- Templating Format
Emailer
Use an instance of the class, setting all the common parts of any email message.
from tussik.email import Emailer
msg = Emailer(host="1.1.1.1")
msg.subject = "Subject"
msg.sender("user@domain.tld", "sender")
msg.to("recipient@domain.tld", "recipient")
msg.html = "<body><h1>Title</h1></body>"
msg.send()
Email Builder
Email template system for building safe HTML emails. Email clients are based on an old version of HTML with various restrictions and cosmetic anomalies.
from tussik.email.Builder import EmailBuilder, EmailTemplateFormatEnum
builder = EmailBuilder()
script = "{}"
builder.load(script, EmailTemplateFormatEnum.json)
saveas_dict = builder.export()
saveas_yaml = builder.export(EmailTemplateFormatEnum.yaml)
saveas_json = builder.export(EmailTemplateFormatEnum.json)
preview = builder.preview()
saveas_html = builder.render()
Load or Export
Loads a template or saves in a format of your selection
- Dictionary
- Yaml
- Json
Editor Preview
Exports in a format that includes configuration values but embedded with the HTML to start, exit, and body of each render part of the template. The purpose is to help the editor manage a presentation and configuration in one.
Generate Html
Accepts custom dictionaries and lists of content to be processed with the currently loaded template.
Update
Working with an Emailer instance the builder will render the subject value, html body, and smtp headers.
from tussik.email.Builder import EmailBuilder, EmailTemplateFormatEnum
from tussik.email import Emailer
builder = EmailBuilder()
script = "{}"
builder.load(script, EmailTemplateFormatEnum.json)
msg = Emailer(host="1.1.1.1")
msg.sender("user@domain.tld", "sender")
msg.to("recipient@domain.tld", "recipient")
builder.update(msg)
msg.send()