Re: Configuring sendmail on Mac OS X (Leopard)?
On Mon, Sep 08, 2008 at 09:50:25AM +0200, mimosinnet@xxxxxxxxx wrote:
} I have to use certain e-mail addresses when sending mail to specific
} sites (i.e.: university and gmail, for example). I was using:
}
} my_hdr From: Joan <university address>
Instead of changing the value of mutt's configuration variable
'sendmail' from the default you should set the configuration variable
'envelope_from'. If that is set, the default is not, if you have
set the 'From:' header as above it will add the "-f Joan <university
address>" to the call to sendmail.
To handle multiple mailboxes you set folder hooks:
http://www.mutt.org/doc/manual/manual-3.html#ss3.5
First set the default state to something reasonable:
folder-hook . set folder=~/Mail
folder-hook . set signature=.signature
folder-hook . set envelope_from=no
folder-hook . unmy_hdr from organization
Then set folder hooks to set things specific to each folder:
folder-hook gmail\\.com set folder=imaps://imap.gmail.com
folder-hook gmail\\.com my_hdr Organization: Scrapbook Club
folder-hook gmail\\.com my_hdr From: Scrappy <scrappy@xxxxxxxxx>
folder-hook gmail\\.com set envelope_from=yes
folder-hook university\\.edu set folder=imaps://mail.university.edu
folder-hook university\\.edu my_hdr Organization: University of the Universe
folder-hook university\\.edu my_hdr From: Dean Serious
<dean.serious@xxxxxxxxxxxxxx>
folder-hook university\\.edu set envelope_from=yes
Each time you enter a folder matching 'gmail\\.com' you will adopt
the 'Scrappy' identity. Switching to a folder matching 'university\\.edu'
adopts the 'Dean Serious' identity. Changing to a folder which does not
match one of the above matches '.' and unsets the folder specific settings.
That handles incoming. Now to get outgoing mail sent to the right
mail server you need to deal with postfix. In OS X Leopard you are
lucky enough to have a recent enough version of postfix to use
'sender_dependent_relayhost_maps'.
Configure your default outgoing mail settings in /etc/postfix/main.cf.
For example:
mydomain = deanserious.org
myorigin = $mydomain
relayhost = [mail.deanserious.org]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
tls_random_source = dev:/dev/urandom
The above sets up a default mail submission port (587) using STARTTLS
to secure the channel and then authenticates the user using the plain
text passwords stored in /etc/postfix/sasl_passwd:
mail.deanserious.org deans:My Password has spaces
smtp.gmail.com scrappy:9secret7
mail.university.edu seriousd:a6RtF42po7rt9
The plain text sasl_passwd file must be hashed into 'sasl_passwd.db':
$ postmap /etc/postfix/sasl_passwd
You don't want your passwords readable by guest users:
$ chown 600 /etc/postfix/sasl_passwd
$ chown 600 /etc/postfix/sasl_passwd.db
Add configuration for sender specific maps in /etc/postfix/main.cf:
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
Map matching from addresses to outgoing mail servers to use in the
plain text /etc/postfix/sender_relay file:
@gmail.com [smtp.gmail.com]:587
@university.edu [mail.university.edu]:587
And finally hash the sender relay maps:
$ postmap /etc/postfix/sender_relay
Outgoing mail will now be sent to mail.deanserious.org unless it
matches '@gmail.com' or '@university.edu' in which case it will
be sent to the mail submission port (587) on 'smtp.gmail.com'
and 'mail.university.edu' respectively.
-Vance