Postfix
From www.hserus.net
Configuring Postfix on a dialup is extremely simple, and well documented in the Postfix FAQ, from which this is mostly a straight cut and paste job - just make changes in /etc/postfix/main.cf (or other files, as below). Local Delivery of some addresses (while sending mail as user@domain), Masquerading etc
In order to send mail as user@domain.name, specify what domain is to be appended to addresses that do not have a domain. In main.cf change these values as below (assuming that your domain is example.com)
myhostname = linuxbox.example.com mydomain = example.com myorigin = $mydomain
In order to receive some users locally, such as root, postmaster (or yourself), specify a virtual lookup table with the non-default destinations:
/etc/postfix/main.cf:
virtual_maps = hash:/etc/postfix/virtual
/etc/postfix/virtual:
root root@linuxbox
postmaster postmaster@linuxbox
suresh suresh@linuxbox
Specify dbm instead of hash if your system uses dbm files instead of db files. To find out what map types Postfix supports, use the command postconf -m. Then, execute the command postmap /etc/postfix/virtual whenever you edit the the virtual table.
Route all outgoing mail to your provider.
If your machine is disconnected most of the time, there isn't a lot of opportunity for Postfix to deliver mail to hard-to-reach corners of the Internet. It's better to drop the mail to a machine that is connected all the time. Add this line to main.cf -
relayhost = your.isps.mail.server
If your ISP requires SMTP AUTH to send out email
In main.cf -
smtp_sasl_auth_enable = yes smtp_sasl_security_options = # above blank to clear default noplaintext - most ISPs # support just PLAIN and LOGIN - both plaintext AUTH smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
In the /etc/postfix/sasl_passwd file -
smtp.example.com login:password
Then do these at the root prompt -
# postmap sasl_passwd
# postfix reload
Disable spontaneous SMTP mail delivery
Normally, Postfix attempts to deliver outbound mail at its convenience. If your machine uses dial on demand (instead of you manually dialing in using wvdial / kppp, this causes your system to place a telephone call whenever you submit new mail, and whenever Postfix retries to deliver delayed mail.
To prevent such telephone calls from being placed, disable spontaneous SMTP mail deliveries (and make postfix queue mails meant for the outside world. Add this line to main.cf -
defer_transports = smtp
Disable SMTP client DNS lookups
To avoid delays caused by Postfix performing sender and recipient domain DNS lookups (which are a waste of time when you are passing mail to a smarthost, and is anyway tough when you are offline), disable all SMTP client DNS lookups. Add this to main.cf -
disable_dns_lookups = yes
Note:
When you disable DNS lookups, you must specify the relayhost as either a numeric IP address, or as a hostname that resolves to one or more IP addresses (with DNS lookup disabled, Postfix does no MX lookup). Flush the mail queue whenever the Internet link is established.
Put /usr/sbin/sendmail -q into your PPP or SLIP dialup scripts (on linux, it's /etc/ppp/ip-up.local). Postfix fits so out of the box into sendmail's place that it cheerfully accepts most sendmail commandline switches (-q, -f, -bs ...). You can also use this script (call it mailq.sh and call it from ip-up.local):
#!/bin/sh # Start deliveries. /usr/sbin/sendmail -q # Allow deliveries to start. sleep 10 # Loop until all messages have been tried # at least once. while mailq | grep '^[^ ]*\*' > /dev/null do sleep 10 done
If you have disabled spontaneous SMTP mail delivery, you also need to run the above command every now and then while the dialup link is up, so that newly-posted mail is flushed from the queue.
