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

Add attachment content-disposition and content-id fields #502

Open
egeersoz opened this issue Oct 27, 2019 · 4 comments · May be fixed by #617 or #631
Open

Add attachment content-disposition and content-id fields #502

egeersoz opened this issue Oct 27, 2019 · 4 comments · May be fixed by #617 or #631

Comments

@egeersoz
Copy link

egeersoz commented Oct 27, 2019

SendGrid api has the following properties for emails:

https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html

See the disposition and content_id properties under attachments.

These turn out to be pretty important when you're sending .ics files (calendar invites). By default SendGrid populates the disposition value with "attachment" if it isempty, but Microsoft Outlook requires it to be set to "inline" in order to display the .ics file as a "native" invitation.

I think since there's a content_type field in the %Bamboo.Attachment{} struct already, it makes sense to also be able to set a content_disposition field.

(Note that when setting disposition to "inline", Sendgrid also requires a unique content_id to be set.)

@egeersoz egeersoz changed the title Add attachment content-disposition field Add attachment content-disposition and content_id fields Oct 27, 2019
@egeersoz egeersoz changed the title Add attachment content-disposition and content_id fields Add attachment content-disposition and content-id fields Oct 27, 2019
@germsvel
Copy link
Collaborator

Hi @egeersoz, thanks for opening this issue and for the patience! I'm taking over maintenance of Bamboo and trying to go through all the issues.

Having the ability to set content_disposition to %Bamboo.Attachment{} makes sense to me and then mapping that to the disposition attribute in the SendgridAdapter.

If this is still of interest to you, I'd be happy to review a PR. Otherwise, I'll try to get to this when I have some time.

@demos74dx
Copy link

Any chance we can merge @sreecodeslayer PR? It looks good to me.

@jarrodmoldrich
Copy link

HI @germsvel and @sreecodeslayer 👋

I've had to solve this problem for the use case of inline images. My approach was to do something a bit more general and to simply allow the user to provide arbitrary header overrides to the adapter. I see @sreecodeslayer that you've implemented a specific solution for your use case, but I'd like you both to consider this one which solves both our problems.

#631

Please let me know what you think. Also note, that for inlined content (at least for images) its important to reorganize the multipart arrangement in the adapter. In particular it needs to be arrange liked this:

start multipart/mixed
  start multipart/related
    start multipart/alternative
      <text and html parts>
    end multipart/alternative
    <inline parts>
  end multipart/related
  <attachment parts>
end multipart/mixed

I've made this change for the bamboo_ses adapter here: kalys/bamboo_ses#43

From some reason bamboo_ses has a duplicated renderer from the :mail module. The PR for that is here: DockYard/elixir-mail#137

@jarrodmoldrich jarrodmoldrich linked a pull request Oct 22, 2021 that will close this issue
@sb8244
Copy link

sb8244 commented Mar 27, 2024

Ran into a problem that I think this issue would solve.

When using the SendgridAdapter, it's not possible (maybe incorrect?) to refer to the inlined images using cid:. This is because the Content-Id header is not set on attachments for SendgridAdapter.

Is there an alternative?

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