nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.67k stars 4k forks source link

improve email headers #41268

Open asaage opened 10 months ago

asaage commented 10 months ago

I've set up my nextcloud to use a dedicated smtp account to send notifications. So if i'm sharing a file or calenderevent the recipient recieves a mail from MyUser Name via MyCloud <cloud@myclouddomain.com> If that recipent tries to answer to that e-mail the cloud-user recives the answer because the mail contains a Reply-To-Header: user@arbitraridomain.com. So far so good.

If on the other hand the recipient has set up an auto-reply (out of office) notification: that will be delivered to cloud@mydomain.com and will never be read by the cloud-user.

  1. can somebody elaborate on weather that's due to the From-Header or the Return-Path-Header? according to rfc3834 the Return-Path should be used.
  2. would it be possible or advisable to set the Return-Path value to the same value as the Reply-To value without running into issues with DKIM / SPF and Spamfilters?
kesselb commented 10 months ago

If on the other hand the recipient has set up an auto-reply (out of office) notification: that will be delivered to cloud@mydomain.com and will never be read by the cloud-user.

Are you talking about the out-of-office feature in Nextcloud Mail, or where did the recipient setup the auto-reply?

asaage commented 10 months ago

Are you talking about the out-of-office feature in Nextcloud Mail, or where did the recipient setup the auto-reply?

I dont know about an out-of-office feature in Nextcloud Mail (not installed in the instances i deal with). Im talking about an out-of-office feature that ist set up by somebody who does not neccessarily have to be a user in nextcloud on their mail backend. Most of the time when that happened it was something from outlook/exchange but but it could also come from plesk, gmx or web.de. - hope that makes sense...

asaage commented 10 months ago

Probably it's a limitation we have to live with. It might be possible to set Return-Path in the mailer but the last mail-delivery-agent in line will most likely overwrite that header with what's found in "From". At least thats what i found here: https://www.postmastery.com/about-the-return-path-header/. Maybe something can be done with envelope? I will leave that open until someone with more knowledge about smtp can shed some light on the problem.

kesselb commented 10 months ago

I found this article helpful: https://stackoverflow.com/questions/1235534/what-is-the-behavior-difference-between-return-path-reply-to-and-from

Probably it's a limitation we have to live with.

That could be.

asaage commented 10 months ago

That could be.

The last answer sounds promising - that would be exactly what's needed.

kesselb commented 10 months ago

Symfony/Mime: https://github.com/symfony/symfony/blob/35703d1f859af7e547f02c0d187e509a52cd0c6e/src/Symfony/Component/Mime/Header/PathHeader.php#L22

Our implementation for the auto-submitted header: https://github.com/nextcloud/server/pull/35876

I guess we need something similar for the return path header.

I'm not sure which component usually adds the Return-Path header and if it's valid to overwrite it. With the given RFC, it seems okay to specify the initiator as return path to make sure delivery failures are reaching the right one.

cc @nickvergessen @ChristophWurst

asaage commented 10 months ago

I can't really find that auto-submitted header in my mails (that would prevent out-of-office autoreplys from triggering - it's not what i am after)

I guess we need something similar for the return path header.

I'm not sure which component usually adds the Return-Path header and if it's valid to overwrite it. With the given RFC, it seems okay to specify the initiator as return path to make sure delivery failures are reaching the right one.

this might be interesting: https://github.com/contao/contao/pull/6433

kesselb commented 10 months ago

that auto-submitted header

I added the pull request as an example of what's to be done to implement an additional header.

Afaik it's only used for new user emails, caldav reminders and activity emails.