-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,28 @@ defmodule Keila.Mailings do | |
end) | ||
end | ||
|
||
@doc """ | ||
Returns the Sender from line in the form of `"Name <[email protected]>"` | ||
If the Sender uses a Send with Keila proxy address, the Reply-to email is printed instead. | ||
""" | ||
@spec sender_from_line(Sender.t()) :: String.t() | ||
def sender_from_line(sender) do | ||
email = | ||
if String.ends_with?(sender.from_email, "@mailings.keilausercontent.com") do | ||
sender.reply_to_email | ||
else | ||
sender.from_email | ||
end | ||
|
||
name = sender.from_name || sender.reply_to_name | ||
|
||
if name do | ||
"#{name} <#{email}>" | ||
else | ||
end | ||
end | ||
|
||
@doc """ | ||
Updates an existing Sender with given params. | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters