Closed sbrink closed 7 years ago
+1
In most of my use cases I would use dynamically generated data that I wouldn't want to store on the hard disk before attaching them to outgoing emails. I think it makes sense to change the Attachment
struct before releasing version 1.0 as @sbrink proposes.
Thank you so much for the suggestion.
I like this idea. I like option 1 of using two different functions, but I think new_from_file
might make more sense since they are both attachments.
I'm not sure about doing the Base64 encoding outside the adapter because there may be adapters that don't need that.
Would one of you be willing to work on a PR for this?
I agree with this.
I made a change in my adapter to accept {:binary, data}
in the path to allow for this (https://github.com/andrewtimberlake/bamboo_sparkpost/blob/feature/attachments/lib/bamboo/adapters/sparkpost_adapter.ex#L173)
I had no time last week. @schurig and I are working on it now.
You rock. Thank you!
Hi everyone!
@sbrink and I were working on a version this afternoon
|> put_attachment %Attachment{filename: "event.ics", data: "raw content..", content_type: "text/calendar"}
Attachment.data
when using |> put_attachment "/hi.jpg"
or |> put_attachment %Plug{..}
attachment.data
Still missing
We're currently implementing it into our Phoenix app. Here are the changes: https://github.com/workshops-de/bamboo/commit/develop
@paulcsmith what do you think?
@schurig It's hard to tell what changed, but from what I can see it looks great! Can you open up a PR so it's easier to see what changed and easier to leave comments. Thanks a ton!
@paulcsmith this one can be closed I think 🎉 🌮
You're right, thank you!
I propose that we change the current
Attachement
struct before releasing version 1.0.Why?
At the moment an attachment struct looks like this:
This only allows uploads from the file system, not dynamically generated contents. An use case for generated contents would be
.ics
files. You want to append a generated.ics
file for adding an event to the user's calendar.Furthermore every adapter has to implement the correct encoding - this is redundant. Here's an example I found from a patch for the bamboo_stmp adapter:
Proposal:
We change the struct definition to:
We could:
new
function intonew_from_data
andnew_from_attachment
new
functionThe new new method does the job of file reading and encoding.
What do you think?