Migrating Sendmail Mail Server
Sat, 10/02/2010 - 00:13 — sandipBelow is how I have migrated mail server with minimum downtime and routing mail to the new server via mailertable, if IP is still pointing to the old server and has not resolved for some ISPs.
-
48 hours prior to migration, set the TTL value for the mail server DNS A record to a short time like 15 minutes.
Prepare for the migration, rsycing the mail spool folder and the user home mail folders.
rsync --progress -a -e "ssh -i /root/.ssh/key -p 22" old.mailserver:/var/spool/mail / /var/spool/mail/
rsync --progress -a -e "ssh -i /root/.ssh/key -p 22" old.mailserver:/var/www/web1/m ail/ /var/www/web1/mail/
rsync --progress -a -e "ssh -i /root/.ssh/key -p 22" --exclude='*/bak' --exclude='*/web' old.mailserver:/var/www/web1/u ser/ /var/www/web1/user/
Run rsync the final time.
Setup Sendmail with mailertable to relay mail coming in to the old server over to the new mail server. This is a similar setup for secondary mail servers.
Add "FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl"
Create "/etc/mail/mailertable" file with contents of the routing table:
domain.tld esmtp:[xxx.xxx.xxx.xxx]
The square brackets skips checking MX records, so IP can be used instead. Remove domain name from "/etc/mail/local-host-names" so mails do not get delivered locally.
Edit "/etc/mail/access" to relay mail for the domain.
TO:domain.tld RELAY
cd /etc/mail
makemap hash access.db < access
makemap hash mailertable.db < mailertable
Test by telneting to port 25 on the old servers' IP and sending email. This should get relayed over to the new server.
Use a new subdomain and redirect existing webmail url to the new server.
- sandip's blog
- Login or register to post comments
resend all mails in sendmail queue
Sun, 07/11/2010 - 23:31 — sandipAs root you can redeliver all mail in the mail server queue via:
sendmail -v -q
- sandip's blog
- Login or register to post comments
Plesk email users and passwords
Wed, 06/09/2010 - 14:42 — sandipBelow is sql, if you ever need to test out your users email accounts on plesk server:
mysql> use psa
mysql> select concat(mail_name,"@" ,name) as email_address, accounts.password from mail left join domains on domains.id=mail.dom_id left join accounts on accounts.id=mail.account_id;
- sandip's blog
- Login or register to post comments
Using a .forward to send mail to multiple accounts
Thu, 05/06/2010 - 14:00 — sandipIf you put multiple addresses in a .forward file, a copy will be sent to each.
remoteuser1@domain.tld, remoteuser2@domain.tld, remoteuser3@domain.tld
If you want to keep a copy of each message in the original account without causing a .forward infinite loop, put a backslash in front of the account name.
\localuser, remoteuser1@domain.tld, remoteuser2@domain.tld, remoteuser3@domain.tld
- sandip's blog
- Login or register to post comments
sendmail access.db by example
Wed, 02/06/2008 - 00:02 — sandipThe sendmail access database file can be created to accept or reject mail from selected domains.
Since "/etc/mail/access" is a database, after creating the text file, use makemap to create the database map.
# makemap hash /etc/mail/access.db < /etc/mail/access
Below is what my access file currently looks like and can be used as a starting point. All internal addresses have been changed except for spammers!!
# by default we allow relaying from localhost... localhost.localdomain RELAY localhost RELAY 127.0.0.1 RELAY # Allow Connect from local server IPs Connect:207.44.206.144 OK # Accept Mail # accept mail from PayPal paypal.com OK # Reject Mail posterclub@e.allposters.c om REJECT posterclub@email.allpos ters.com REJECT plastmarket.com REJECT jr@jrtr.org REJECT 7b2.606@fe01.atl2.webus enet.com REJECT mysoldpad.com REJECT # Discard Mail 1and1-private-registratio n.com DISCARD # forum admin mails: fictionaluser@gmail.com DISCARD # Reject full mailbox fictionaluser@linuxweb log.com ERROR:4.2.2:450 mailbox full fictionaluser@linuxweblog .net REJECT # Blacklist recipients linuxweblog.net ERROR:550 That host does not accept mail # Spam friend domains: exempt domains from dnsbl list checking Spam:linuxweblog.org FRIEND # Spam friend users: exempt email users from dnsbl list checking # example: # Spam:user@domain.tld FRIEND # clients Spam:fictionalclient@h otmail.com FRIEND # Auto REJECT via hourly cron added below