1
0
forked from migadu/mailex

add extra headers

This commit is contained in:
Dejan Strbac 2015-12-23 19:02:56 +01:00
parent ae539c8d53
commit f40ecb33f8
2 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,5 @@
defmodule Mailex.Email do defmodule Mailex.Email do
defstruct subject: nil, from: nil, reply_to: nil, to: nil, cc: nil, bcc: nil, attachments: nil, html: nil, text: nil defstruct subject: nil, from: nil, reply_to: nil, to: nil, cc: nil, bcc: nil, headers: nil, attachments: nil, html: nil, text: nil
end end

View File

@ -121,6 +121,9 @@ defmodule Mailex.Render do
if email.to && (length(email.to) > 0), do: if email.to && (length(email.to) > 0), do:
headers = [ { "To", email.to |> stringify_addresses } | headers ] headers = [ { "To", email.to |> stringify_addresses } | headers ]
if email.headers && (length(email.headers) > 0), do:
headers = headers ++ email.headers
[ { "From", email.from |> stringify_addresses }, [ { "From", email.from |> stringify_addresses },
{ "Subject", email.subject || "" } | headers ] { "Subject", email.subject || "" } | headers ]
end end