Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

CompanyA sends mail, I want to respond to them with me@companyA.com and signatureA. When CompanyB sends mail, I want to respond to them with me@companyB.com and signature B. Etc.

1. How can I do a hook to change the line `set from="me@CompanyX.com" in .muttrc?

2. How can I -- change the signature according to the sender A, B, C, etc?

If someone has a similar problem of having many work -emails that you forward to your server to manage, please, provide me details how you manage this kind of activity. I use mutt, procmail and I have full-blown *ix servers if needing something special.

share|improve this question
add comment

1 Answer

You can acheive both your goals with mutt.

To respond to CompanyA from your me@companyA.com address, you would create a folder for each company, and an accompanying .rc file in .mutt/ - and then call the required file from your .muttrc. So, for Company A, you would create .mutt/companya.muttrc:

set from      = "me@companyA.com"
set mbox      = "+CompanyA/archive"
set record    = "+CompanyA/INBOX.Sent"
set postponed = "+CompanyA/INBOX.Drafts"

...and then repeat for B.

And in your .muttrc:

folder-hook CompanyA/* source ~/.mutt/companya.muttrc
folder-hook CompanyB/* source ~/.mutt/companyb.muttrc
...
# boxes
mailboxes +CompanyA/INBOX +CompanyA/Sent +CompanyA/Drafts +CompanyA/Trash
mailboxes +CompanyB/INBOX +CompanyB/Sent +CompanyB/Drafts +CompanyB/Trash

To use the correct signature, depending on who you are responding to, use these hooks in your muttrc:

# set correct signature
send-hook "~f @companyA.com"  set signature=~/.mutt/A.sig
send-hook "~f @companyB.com"  set signature=~/.mutt/B.sig

You could then use keybinds to easily switch between folders:

macro index ga       "<change-folder> =CompanyA/INBOX"       "go to Inbox"
macro index gb       "<change-folder> =CompanyB/INBOX"       "go to Inbox"
share|improve this answer
    
Could you clarify this point "and an accompanying .rc file in .mutt/"? –  user2362 Jun 4 '12 at 20:05
1  
Essentially, you are breaking out parts of your config into separate files, to allow you to source the relevant options depending on what folder you are working with. So, for CompanyA, you have a .mutt/companya.muttrc and for CompanyB a .mutt/companyb.muttrc and an overall .mutt/muttrc. See my mutt setup for how I do it. –  jasonwryan Jun 4 '12 at 20:07
    
I am confused by hooks. I get now all the time one settings so have to understand them better: "send-hook "~f @CompanyA.com" some.sig" and "folder-hook comp/* source ~/.muttr/something.muttrc", investigating. If I send email and if I relpy to email, does it look for sender -email or how does this work in practise? Do I need to specify somehow with which comp info I want to send? Anyway have to read your trial deeper, second... –  user2362 Jun 4 '12 at 20:38
add comment

Your Answer

 
discard

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