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

Feature/attachment headers #43

Closed

Conversation

jarrodmoldrich
Copy link

@jarrodmoldrich jarrodmoldrich commented Oct 22, 2021

Hi @kalys 👋

In a related PR to thoughtbot/bamboo I've exposed a variable in Bamboo.Attachment called :headers that can pass a number of arbitrary headers as a keyword list, permitting overrides of headers (e.g., Content-Disposition) or adding other special cases (e.g., X-Content-Id). The purpose is to give extra control to the library consumer, and the benefit for me, in particular, is to add inline image attachments that work well in a variety of email clients.

As well as these extra headers, there's a need to reorganize and wrap the inline attachments in a multipart/related part. I'll be pushing another related PR for that to DockYard/elixir-mail shortly, but I also duplicated the changes to the RFC2822Renderer module in this library. The update shouldn't regress any prior behavior, and I feel that the new code is appreciably more legible. From my testing, inline images now work properly in Outlook webmail with this change.

I haven't added anything to test suite yet, but will proceed to work on this PR if I have your blessing. So please let me know!

Cheers,

Jarrod

Related PRs:
beam-community/bamboo#631
DockYard/elixir-mail#137

@kalys
Copy link
Owner

kalys commented Oct 26, 2021

Hey @jarrodmoldrich.

Thank you for your contribution to the library.

Let's wait until your bamboo PR is merged.

This change in contingent upon an update to the bamboo library to
include a `:headers` key in `Bamboo.Attachment` that holds a keyword
list of headers that will override *all* others.

For e.g., in the specific use-case of adding inlined attachments, some
special case headers are required. Now it's possible to add
`X-Attachment-Id` and override the Content-Disposition header with
`inline` to permit the proper display of inlined content, without an
email client showing them as explicit attachments for the user to
download.
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 this pull request may close these issues.

None yet

2 participants