DSLify HTML email creation (+ also from template)
ifesdjeen opened this issue · comments
Right now, I assume that text ones are default. I realize that it's very easy to just add 1 line to specify content type, but I think it's good to have it available within DSL.
In what DSL?
I have no suggestions. I'll try several things that came to my mind during next weeks...
Do you have an approach on this? I would be available to add html support if you think it's worth (and also because I need it).
Thanks
@guilespi I don't have any specific ideas, feel free to experiment. We can always tweak things a few times. It perhaps can be as simple as one new function?
Thanks for considering to help!
I was thinking about adding a new optional parameter, content-type
to deliver-email
and build-email
.
If parameter not present everything stays the same (defaults to plain-text
)
:body {:type "text/html" :content "<b>test</b>"}
So the signatures would change to:
(defn build-email
"Builds up a mail message (returned as an immutable map).
Body is rendered from a given template."
([m ^String template data content-type]
...)
(defn deliver-email
"Delivers a mail message using delivery mode specified by the *delivery-mode* var.
Body is rendered from a given template."
([m ^String template data]
(deliver-email m template data :text/plain))
([m ^String template data content-type]
...)
Sounds good?
Sounds good
I believe this has been addressed by #7. Let me know if it hasn't.