-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attached local PDF files #110
Comments
Are you getting an error of some kind? |
yes, sure,
my file: #!/usr/bin/env python
# -*- coding: utf-8 -*-
import yaml
from postmark.core import PMMail
import os
# postmark setup
pmApiKey = os.environ['PM_API_KEY']
pmSender = os.environ['PM_SENDER']
pmBCC = os.environ['PM_BCC']
pmTag = os.environ['PM_TAG']
templateId = os.environ['TEMPLATE_ID']
src_pdf = "./sample.pdf"
with open(src_pdf, 'rb') as f:
pdf_file = f.read()
attachments = [
("sample.pdf", pdf_file, 'application/pdf')
]
if os.path.exists(src_pdf) :
template_model = {'year': '2022', 'month': '03', 'email': '[email protected]', 'name': 'Toto Lolo'}
message = PMMail(
sender=pmSender,
# to=email,
to='[email protected]',
bcc=pmBCC,
template_id=template_id,
template_model=template_model,
tag=pmTag,
attachments=attachments,
api_key=pmApiKey
)
message.send() and here error in action |
What happens when you do a normal read on the file, not a read-bytes?
|
Also take a peek at this one #93 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I try to send local PDF files but isn't work,
do you know what is wrong?
Thanks
The text was updated successfully, but these errors were encountered: