Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use mutt with multiple accounts. I would like to use different smtp servers for sending email via ssmtp. One internal provided by the company (imap is supported) and one for my private emails (gmail).

share|improve this question

At least in mutt 1.5, you can use send2-hook to change configuration values based on the sender address for each message. From the documentation:

send2-hook is executed after send-hook, and can, e.g., be used to set parameters such as the $sendmail variable depending on the message's sender address.

While I have not tried it myself, it sounds like a combination of this, ssmtp that you mention, and getmail to download mail from your Gmail account, should do nicely. You may want to throw in procmail as well to do client-side mail sorting.

For easier handling of multiple sender addresses, I myself have the following in my mutt configuration:

alias f__1 Me <my.one@address.example.org>
alias f__2 Myself <another@address.example.com>
alias f__3 I <somewhere@else.local>
macro compose <esc>f "<edit-from><kill-line>f__<tab><search>another@address.example.com<enter>"

With this in place, I just hit escape f in the compose screen to change the sender address, and it defaults to the one I most often use. Partly for historical reasons, I use a folder-hook to set $smtp_url, but from the sound of the documentation it should be trivial to use send2-hook instead.

The one thing I have not found a trivial way of handling is signatures. You can use folder-hooks to set the value of $signature on a per-folder basis, but that's about as close as I have been able to (or more accurately, bothered to) get.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.