-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
I want forward emails by simply changing the :to address.
The way it goes:
- Get email by gen_smtp.
- Parse email with
Mailman.Email.parse!/1into%Mailman.Email{} - Change the
:toaddressemail = %Mailman.Email{}; email = Map.put(email, :to, ["[email protected]"]) - Send email by
{:ok, sent_email} = Mailman.deliver(email, config())
After step 3 the email looks like this:
%Mailman.Email{
attachments: [
%Mailman.Attachment{
data: <<0, 0, 0, 0, 0, 171, 205, 239, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 9,
0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2, 0, ...>>,
disposition: "",
file_name: "users.dets",
mime_sub_type: "octet-stream",
mime_type: "application"
}
],
bcc: [],
cc: [],
data: %{},
delivery: "Wed, 28 Apr 2021 06:45:38 +0200",
from: "[email protected]",
html: "<!DOCTYPE html><html><head><title></title><style type=\"text/css\">p.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Hallo Welt,<br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\"><br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">ich bin eine HTML Mail. <br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\"><br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Foo<br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Bar<br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Baz<br></div></body></html>",
reply_to: "",
subject: "Testmail mit Umlauten Ä Ö Ü",
text: "Hallo Welt,\r\n\r\nich bin eine HTML Mail. \r\n\r\nFoo\r\nBar\r\nBaz",
to: ["[email protected]"]
}When I parse sent_email after step 4 it looks like this:
%Mailman.Email{
attachments: [],
bcc: [],
cc: [],
data: %{},
delivery: "Wed, 28 Apr 2021 06:46:34 +0200",
from: "[email protected]",
html: "<!DOCTYPE html><html><head><title></title><style type=\"text/css\">p.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Hallo Welt,<br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\"><br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">ich bin eine HTML Mail. <br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\"><br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Foo<br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Bar<br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Baz<br></div></body></html>",
reply_to: "",
subject: "Testmail mit Umlauten Ä Ö Ü",
text: "Hallo Welt,\r\n\r\nich bin eine HTML Mail. \r\n\r\nFoo\r\nBar\r\nBaz",
to: ["[email protected]"]
}While sending, the attachments disapear and they do not arrive at the destination mailbox. Please can you show me, what is my mistake here? Do I have to set any special config parameters?
runiq
Metadata
Metadata
Assignees
Labels
No labels