]> git.proxmox.com Git - proxmox.git/commit
notify: smtp: forward original message instead nesting
authorLukas Wagner <l.wagner@proxmox.com>
Wed, 10 Jan 2024 09:52:51 +0000 (10:52 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 10 Jan 2024 11:20:41 +0000 (12:20 +0100)
commitb03c39403931e950853b587ef7ab02f486598077
treeb465817dd4b2fba75ac2d2a02bd99da322da1357
parent674ab33a438ad9d61c0ecba5979455c3d548f80c
notify: smtp: forward original message instead nesting

For mails forwarded by `proxmox-mail-forward` to an SMTP target, the
original message was nested as a 'message/rfc822' message part.
Originally this approach was chosen to avoid having to rewrite
message headers.
Good email-clients, such as Thunderbird can display these inline.
Other, more limited clients will show these messages as an attached
.eml file, which is not really a good user experience.

This patch changes the approach for message forwarding to be more like
forwarding mails in a mail client. We create a new message and
add the original message body as a body. Additionally, we also copy
over all message headers that are relevant to correctly display the
original message body (e.g. Content-Type, Content-Transfer-Encoding)

Tested with a couple of different email messages (varying in
structure, body parts, encoding, etc.) against the following SMTP
relays:
  - gmail
  - outlook
  - our own webmail service

Originally reported in our community forum:
https://forum.proxmox.com/threads/proxmox-mail-forward-sends-mails-as-eml.137710/

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
proxmox-notify/src/endpoints/smtp.rs