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

Content-ID extra angle brackets for inline images #21

Closed
stevejarvis opened this issue Apr 8, 2018 · 1 comment
Closed

Content-ID extra angle brackets for inline images #21

stevejarvis opened this issue Apr 8, 2018 · 1 comment

Comments

@stevejarvis
Copy link

Hey, think there's an issue with inline images and the Content-ID tag. When using the default Django mailer, I can attach an image like this and all is well:

        with open(attachment_path, "rb") as image_file:
            msg_img = MIMEImage(image_file.read())
            msg_img.add_header('Content-ID', '<{}>'.format(filename))
            msg.attach(msg_img)

The message comes through with inline images, and the Content-ID tag set appropriately, like:

Content-Type: image/jpeg
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-ID: <myinlineimage.jpg>

When I do the same thing with this lib, those Content-ID angle brackets are doubled up, like:

Content-Disposition: inline; filename="part-1348a3fe9ce14c1da8c64b0eda3ad104.jpe"
Content-ID: <<myinlineimage.jpg>>
Content-Transfer-Encoding: base64
Content-Type: image/jpeg; name="part-1348a3fe9ce14c1da8c64b0eda3ad104.jpe"

That doesn't render, since it's not the correct format, and the images are just attachments instead of inline. I'm guessing the underlying sendgrid lib is the one adding the extra angle bracket, so to maintain API compatibility with Django's default mailer this lib probably has to strip existing brackets on the attachment?

@sklarsa
Copy link
Owner

sklarsa commented Apr 21, 2018

Sorry I was out of the country for the past few weeks so I couldn't respond sooner.

Thank seems like the right thing to do. I will get to this shortly.

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

2 participants