Send message using mutt from non-default account

891 Views Asked by At

You can send a message via mutt with a command like so:

mutt -s "Test Email" [email protected] < message.txt

This will send a message from the default account.

I have two e-mail accounts set up with mutt and I want to send a message from the account that is not the default. I tried changing the From field via -e 'my_hdr From:[email protected] but the attempt failed with a SendAsDeniedException (my default e-mail is with Microsoft outlook.com).

So how can I send a message from the other account via the command line? (I want to automate my messages.)

1

There are 1 best solutions below

1
On

I assume that you have configured your accounts in separate files. Simply load the corresponding configuration beforehand.

mutt -e "source ~/.mutt/accounts/account1" -s "Test Email" [email protected] < message.txt