Postmark is one of the connectors offered in Peliqan to send emails and receive emails.
Postmark offers a free license that does not expire, for up to 100 emails per month.
More info: https://postmarkapp.com/pricing
Sign up for an account on Postmark first. Create a “Server” in Postmark.
Copy the API token of the Server. In Peliqan, go to Connections > Add connection.
Find Postmark in the list of available connectors and select it. Paste the API token and save.
Here are example scripts in Peliqan to send out emails.
email = {
"from": "[email protected]",
"to": "[email protected]",
"subject": "Hi there",
"text": "We are happy to provide you with this report !",
"html": "We are <b>happy</b> to provide you with this report !"
}
conn = pq.connect('Postmark')
result = conn.add('email', email)
st.json(result) # for debugging only, see result of sending email to Postmark
import base64
text_file_content = "This will be in the attached text file."
email = {
"from": "[email protected]",
"to": "[email protected]",
"subject": "Test email with attachment",
"text": "See Text file attached.",
"html": "See Text file attached.",
"attachment_name": "my_file.txt",
"attachment_content_base64": base64.b64encode(text_file_content.encode("ascii")).decode("ascii"),
"attachment_contenttype": "text/plain"
}
conn = pq.connect('Postmark')
result = conn.add('email_with_attachment', email)
st.json(result) # for debugging only, see result of sending email to Postmark
See the Alerting & Messaging section for examples on how to send out CSV files with data from a Peliqan table:
See the Reporting section for a detailed example on how to generate a PDF file and send that PDF file as an attachment in an email:
Generate and distribute PDF reports