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

Attached files show up twice in emails (two identical copies) #25

Open
cool-RR opened this issue Jul 7, 2014 · 4 comments · May be fixed by #30
Open

Attached files show up twice in emails (two identical copies) #25

cool-RR opened this issue Jul 7, 2014 · 4 comments · May be fixed by #30

Comments

@cool-RR
Copy link

cool-RR commented Jul 7, 2014

No description provided.

@cool-RR
Copy link
Author

cool-RR commented May 22, 2015

Crickets

@cool-RR
Copy link
Author

cool-RR commented Sep 30, 2015

I know it's only September, but solving this ticket would be a great early Christmas present.

@Lvl4Sword
Copy link

Using the following:

import datetime
import envelopes

def mail_send(files_to_send):

    archive_path = '/home/user/archive/'
    files_to_send = ['1.jpg', '2.jpg', '3.jpg']

    print(files_to_send)

    right_now = datetime.datetime.now()

    envelope = Envelope(
        from_addr = ('edited', 'FROM_NAME'),
        to_addr = ('edited', 'TO_NAME'),
        subject = 'Log Report: {0}'.format(right_now.strftime("%Y/%m/%d")),
        text_body = ""
    )

    for each in files_to_send:
        envelope.add_attachment(archive_path + each)

    envelope.send('smtp.googlemail.com', login='edited',
                  password='edited', tls=True)

i get 1.jpg sent twice, so i'm having this same issue.

EDIT: this is just an issue with gmail's interface. you can also verify this by clicking "show original" in gmail, and noticing that it shows no duplicate attachment.

@Lvl4Sword
Copy link

this is still an issue with envelopes though, and i've sent images using programs/accounts outside of envelopes and they work perfectly. turns out these other images i've sent use "mixed" rather than "alternative" for the multipart. i also found the fix from #27, and believe the fix should be pushed and both of these issues set as solved 👍

tl;dr: change msg = MIMEMultipart('alternative') to msg = MIMEMultipart('mixed')
on line 276 in to_mime_message in envelopes.py

@Lvl4Sword Lvl4Sword linked a pull request Apr 1, 2016 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants