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

Any options for inline attachments MailgunAdopter #430

Open
ijunaid8989 opened this issue Sep 5, 2018 · 3 comments
Open

Any options for inline attachments MailgunAdopter #430

ijunaid8989 opened this issue Sep 5, 2018 · 3 comments
Labels
adapter Related to supported adapters enhancement stale:discard

Comments

@ijunaid8989
Copy link

In past, we were using mailgun wrapper https://github.com/evercam/mailgun/commit/8c73ada08137ce875b487949167d60fecb1715dc and added inline attachment options by ourselves.

Now we are planning to switch to Bamboo, and I have done formal emails method conversion from mailgun to bamboo mailgun adopter but it's not sending inline attachments, Is there any option for that in bamboo?

For emails like

image

Instead of showing image as mentioned in template.

<img src="cid:snapshot.jpg" alt='Last Snapshot' style="width: 100%; display:block; margin:0 auto;">

its just showing it alt text. and in the bottom it attached the snapshot. I am sorry if that is not the right place to ask this. I have tried in Elixir Slack channel but no one is interested to answer.

@lancejjohnson lancejjohnson added adapter Related to supported adapters enhancement queued labels Apr 2, 2019
@germsvel
Copy link
Collaborator

Hi @ijunaid8989 thanks so much for opening the issue and for the patience! I'm just starting to maintain Bamboo and trying to look through the open issues.

This seems related to #502. It seems like it might be good to allow people to set the content_disposition and then map that to the adapters as needed.

If this is still something of interest, let me know. I'll try to get to it, or if you're up for it, I'd be happy to review a PR.

@germsvel germsvel removed the queued label May 14, 2021
@jarrodmoldrich
Copy link

jarrodmoldrich commented Oct 21, 2021

Hi @germsvel,

I've just encountered this issue using the bamboo_ses adapter, and I realise that to get inline images, it touches a lot of places in the code base.

Right now, attachments are abstracted by the Bamboo.Attachment struct, which means that you can add a Content-Id header, but you can't add an X-Attachment-Id, or change the Content-Disposition from attachment to inline. Also parts need to be restructured depending on whether inline, non-inline, or both types are being attached. The body of the email should be in the same multipart/related part as any inline attachments, but non-inline attachments live in the outer multipart/mixed part, though it's a little more nuanced than that:

https://stackoverflow.com/questions/30351465/html-email-with-inline-attachments-and-non-inline-attachments

As a lot of things need to change depending on whether the attachment needs to be inline or not, so I'd recommend adding a boolean to the Attachment struct. According to this boolean being set to true, the following things would need to occur:

  1. a Content-Id header must be supplied
  2. a X-Attachment-Id header is added that matches Content-Ids raw value
  3. the Content-Id is surrounded by <angle brackets>
  4. set Content-Disposition to inline
  5. wrap multipart/alternative containing html/text email body with a multipart/related
  6. insert inline attachment into multipart/related wrapper

This is as much as I can surmise in my 2 hours of research, and particularly point no. 3 might be archaic, so you might know better, or there might be new guidelines for approaching this. I'd be curious to know your thoughts, and if you're all tied up, I might be able to jump in and make a PR. Either way, I need to get this to work for myself, so let me know.

Cheers,

Jarrod

Copy link
Contributor

github-actions bot commented Oct 2, 2024

This issue has been automatically marked as "stale:discard". We are sorry that we haven't been able to prioritize it yet.
If this issue still relevant, please leave any comment if you have any new additional information that helps to solve this issue. We encourage you to create a pull request, if you can. We are happy to help you with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapter Related to supported adapters enhancement stale:discard
Projects
None yet
Development

No branches or pull requests

4 participants