* On Wed, Aug 16, 2006 at 06:37:28PM +1000, Jobst Schmalenbach wrote:
> On Wed, Aug 09, 2006 at 11:58:45AM +1000, Peter Miller ([EMAIL PROTECTED]) 
> wrote:
> > On Wed, 2006-08-09 at 11:22 +1000, Jobst Schmalenbach wrote:
> > > On Wed, Aug 09, 2006 at 08:14:40AM +1000, Peter Miller ([EMAIL 
> > > PROTECTED]) wrote:
> > > > Is there any elegant way to have a laptop DHCP client have its sendmail
> > > > configured properly?  In all the cases I have to deal with, my laptop is
> > > > a DHCP client is behind a NAT firewall.

Out of interest, I have a similar problem (laptop, different smtp
servers depending on ip address). Under postfix it's easy to fix -
there's a command called 'postconf' that allows you to change the config
without editing. I run a script like this regularly from crontab:

| postconf -e "defer_transports = "
| postconf -e "relayhost = "
| 
| # if we're at home, send email instantly using foobar as relay
| myip=`ip a sh eth1 | grep 'inet\>' | awk '{print $2}'`
| if [ $myip = "192.168.2.1/24" ] ; then
|     postconf -e "relayhost = [192.168.2.254]:25"
|     postfix reload
|     postfix flush
|     exit 0
| fi
| 
| # and so on, for different networks...
| 
| # otherwise, just defer transport
| postconf -e "defer_transports = smtp"
| postfix reload
| postfix flush

-- 
Sonia Hamilton. GPG key A8B77238.
.
One OS to rule them all, One OS to find them.
One OS to call them all, And in salvation bind them.
In the bright land of Linux, Where the hackers play. 
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to