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

added attachment support #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/postmark/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,20 @@
(or (= java.lang.String (class to))
(<= (count to) 20)))

(defn- attachment
"Add attachment to email. Content must be a base64 encoded string."
[{:keys [name content content-type]}]
{
"Name" name
"Content" content
"ContentType" content-type})


(defn- mail
"Send an email with the Postmark API.

Remember: Postmark only lets you send to at most twenty addresses at once."
[api-key from {:keys [to subject cc bcc tag text html reply-to]}]
[api-key from {:keys [to subject cc bcc tag text html reply-to attachments]}]
{:pre [(no-more-than-20-recipients to)]}
(send-to-postmark api-key {"From" from
"To" (get-to-string to)
Expand All @@ -50,7 +58,8 @@
"Tag" tag
"TextBody" text
"HtmlBody" html
"ReplyTo" reply-to}))
"ReplyTo" reply-to
"Attachments" (map attachment attachments)}))


(defn postmark [api-key from]
Expand Down