-
Notifications
You must be signed in to change notification settings - Fork 31
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
Documentation: some more examples for common use cases (adding extra headers) #7
Comments
Hello http://www.magiksys.net/pyzmail/api/pyzmail-module.html Most of the functions have a doc_string with a lot of information. For the the headers, see : http://www.magiksys.net/pyzmail/api/pyzmail.generate-module.html#complete_mail Their is a sample :
that show how to add custom headers. compose_mail() call build_mail() and complete_mail() Most information that are not in the short documentation pages are in the API documentation (but you already know that :-) ). And you can read the source for more. Hope this help. I'm sorry, I will not change the documentation for this because the information is available in the API documentation. Thanks for using pyzmail. Regards |
I disagree: I followed the API docs, yet it generated a completely wrong header for Disposition-Notification-To. Code: formatted_receipt_addr = format_addresses(
['[email protected]'],
"Disposition-Notification-To",
"utf-8").encode()
extra_headers = [("Disposition-Notification-To", formatted_receipt_addr)]
# later on... ENCODING is utf-8
mail_structure = compose_mail(sender, recipients, subject, ENCODING,
(text, ENCODING), html=None,
attachments=attachments,
headers=extra_headers,
bcc=bcc) However this creates a completely wrong header:
I likely did something wrong, but I just followed the API docs. |
pyzmail don't support what you want to do :-( I have pushed a fix to support email.header.Header instances in the header. formatted_receipt_addr = format_addresses( without the .encode() at the end. |
I'm opening this as an issue so it's tracked. In particular, it would be nice to have in the docs some indication on how to add extra headers for common operations like
Disposition-Notification-To
. I had to hunt down the API docs and I couldn't quite get them to work (malformed email addresses).So, a little example in the documentation would help a lot.
The text was updated successfully, but these errors were encountered: