#29 Modify Sendmail Path via Role

Fabian Schilling

re-alpine can be configured to use different SMTP-servers for different roles/accounts.
The user should also be able to instead invoke sendmail or msmtp with custom options on a per role basis. Currently the value for "Sendmail Path" is static. Meaning it is not possible to dynamically invoke sendmail/msmtp with different command-line options.

This makes it difficult to use msmtp/sendmail with more than one account.

The way I would like to set the Sendmail Path:
1. Go to the config-menue of a role
2. Decide whether you want to directly talk to an SMTP-server or use sendmail
3. In case sendmail is selected have an input-field available that overwrites the value of "Sendmail Path"

How it works with just one account:
Set "Sendmail Path" to:

/usr/bin/msmtp -a example -f user@example.com -t

  • -a specifies the account to use for sending
  • -f sets the envelope-from-address
  • -t reads the recipient addresses from the To, Cc, and Bcc headers of the mail

It would be nice to change the -a and the -f option depending on what role is used for composing.

There is a workaround that I described on my blog (Section "Sending mail with msmtp") but it shouldn't be msmtp's job to guess which account the user wants to use.