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

Refactor the way we add attachments to emails #140

Open
kdisneur opened this issue May 7, 2020 · 0 comments
Open

Refactor the way we add attachments to emails #140

kdisneur opened this issue May 7, 2020 · 0 comments

Comments

@kdisneur
Copy link
Contributor

kdisneur commented May 7, 2020

We started by just adding the attachments as base64 encoded data in the right place of the email. It was a simple implementation.

With the pull-request #137, we discovered the way we encode attachment can be related to the content-type of the attachment.

When we added the fixes, we had to split logic in two different places:

  1. the place where we encode the attachment https://github.com/fewlinesco/bamboo_smtp/blob/develop/lib/bamboo/adapters/smtp_adapter.ex#L229
  2. the place where we put headers based on the kind of attachment https://github.com/fewlinesco/bamboo_smtp/blob/develop/lib/bamboo/adapters/smtp_adapter.ex#L207...L224

If we start to split the logic in different places I'm a bit afraid the maintenance will become harder when we add more kind of attachments.

We need to think / draft how to refactor this part of the library to make it easier to add support for new kind of attachments.

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

1 participant