mailman-elixir / mailman

Mailman provides a clean way of defining mailers in your Elixir applications
https://github.com/mailman-elixir/mailman
Other
203 stars 73 forks source link

How can I change the return path before deliver the mail? #97

Open schaary opened 2 years ago

schaary commented 2 years ago

I would like to change the return path of the email. But no matter what I try:

def deliver(return_path, from, to, email) do
   email = email
     |> Map.put(:to, [to])
     |> Map.put(:from, from)
     |> Map.put(:reply_to, from)
     |> Map.put(:return_path, return_path)

  {:ok, send_mail} = Mailman.deliver(email, config())
end

or

def deliver(return_path, from, to, email) do
   email = email
     |> Map.put(:to, [to])
     |> Map.put(:from, from)
     |> Map.put(:reply_to, from)
     |> Map.put_new(:return_path, return_path)

  {:ok, send_mail} = Mailman.deliver(email, config())
end

... the return path of the outgoing email is set to the same value as the from: value.

Is there a way to change the value of the return-path?