leahneukirchen / mblaze

Unix utilities to deal with Maildir
Other
441 stars 48 forks source link

Handling different envelope-from addresses? #205

Closed Anachron closed 3 years ago

Anachron commented 3 years ago

Not sure if this is the right place to ask, but let's say I want to send mails from example1@mail.domain using the account collection1@mail.domain. Should setting a different From header in mblaze suffice? my MTA is msmtp but I cannot figure out how to correctly handle different sender addresses.

leahneukirchen commented 3 years ago

I think you want --read-envelope-from then.

I use plain From: headers with OpenSMTPD and rules like match mail-from "@example.org" for any action "..."

Anachron commented 3 years ago

That's what I use but msmtp chooses the wrong account in this case:

msmtp: envelope from address example1@mail.domain not accepted by the server
msmtp: server message: 550-Requested action not taken: mailbox unavailable
msmtp: server message: 550 Sender address is not allowed.
msmtp: could not send mail (account default from /home/USER/.msmtprc)

How does msmtp figure out which account to use for my changed from-address?

Edit: I guess iI have to either edit the default account before sending or provide a mapping to an account for each mail-address like so:

# A second mail address at Runbox # The colon tells it to inherit the settings from the previous account 
account runbox2: runbox
from different-email@mydomain.com
Anachron commented 3 years ago

I've fixed this for now with my mfrom script also modifying the account default setting in my ~/.msmtprc. ! test -e ~/.msmtprc || sed -i "s|account default.*|account default: ${1}|" ~/.msmtprc

Closing this as it's not an issue with mblaze.