Skip to content
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

How to attach binary files to outgoing emails #14

Open
nnako opened this issue Nov 6, 2016 · 0 comments
Open

How to attach binary files to outgoing emails #14

nnako opened this issue Nov 6, 2016 · 0 comments

Comments

@nnako
Copy link

nnako commented Nov 6, 2016

Hi,

thank you for this great module. Until now, it has provided a useful support.

Unfortunately, all the examples I have seen so far (even from the API documentation) show only how to attach TEXT FILES or a GIF IMAGE into an html email. What I want to do in short:

My application receives an email and extracts its attachments. After deciding what to do, some of these attachments (PDF, text, image,...) are to be forwarded to various revipients using the pyzmail module. But I can not figure out how to correctly tell the compose_mail() function how to do this. Here is my code so far:

# create new payload
payload, mail_from, rcpt_to, msg_id = pyzmail.compose_mail(
    ( <sendername> , <senderemail> ),
    [ <receiveremail> ],
    <subjectstring> ,
    'utf-8',
    ( <bodytext> , 'utf-8'),
    attachment=[( ...???... )]
    )

For example:

I have these three files within my folder /home/temp/:

  • test.PDF
  • test.PNG
  • test.TXT

How would I design the attachment part of the compose_mail() function to successfully get these files to the desired receiver?

Thank you in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant