[CLUE-Tech] [TECH] - How to resend email in server mailbox

Jim Ockers ockers at ockers.net
Fri Jan 23 15:13:35 MST 2004


Gary:

> Several months ago, I had a client move their mail internally (on to MS
> Exchange). I dutifully changed the MX record to point to the new
> location (they use my nameservers). I also added a second MX record with
> a lower delivery precedence set to my mail server. Clearly, the intent
> was to allow my mail server to act as a backup to capture email case
> they're internal server went down. Well, the catastrophic happened over
> the last few days with their internal server going down (the MS Exchange
> server is not my responsibility). My server dutifully accepted delivery
> of their email. I'm now realizing that I didn't complete the setup of
> the backup email situation and now have to do it by hand (no fun, but
> I'll do it).
> 
> I'm looking for advice on how to do both of the following (if, indeed,
> I'm even asking the right questions):
> 
> 1. Deliver the email in their email boxes on my system (only a couple
> doxen accounts) to their email server now that it is back online.

Put all of the usernames in a temp file /tmp/users.txt, and do this:

#!/bin/bash
for user in `cat /tmp/users.txt` ; do
	cat /var/spool/mail/$user | formail -s sendmail $user at their.exchange.server
	cp /dev/null /var/spool/mail/$user #only do this if you're sure
done

Make sure their exchange server properly accepts e-mail formatted as
username at their.exchange.server BEFORE you fire off all of the e-mail
to their exchange server.  If the user accounts on your system
are different than the e-mail addresses on the exchange server, then
you will have to do username lookup and translation; that's left as 
an exercise for the reader.

> 2. Setup my mail server (linux with patched versions of pop3d, imapd and
> sendmail) so that it can hold mail for my client if their internal email
> server is down (MS Exchange) and then deliver it to their internal email
> server once it is back up.
> 
> I did a quick Google search but I think I'm searching on the wrong
> keywords because I'm not finding anything helpful. Any help or direction
> would be much appreciated.

The "right" way to do secondary MX is just to spool up the mail in
your mail queue, and then deliver it to the preferred MX (as set in
the DNS) once it's back up.  This is the default behavior of sendmail,
and is tried & true.  Why mess with it?  [Unless you're dealing
with a spam problem?]

Why do you have user e-mail accounts for their exchange users on your
mail server anyway?

If they want really buzzword-compliant "redundancy" they could add 
another exchange server as part of a "cluster" of "Windows 2003"
servers with "active directory" so that when things break they 
break spectacularly.  That is the only easy way I know of to have 
multiple servers with the same mailbox content on each server.

-- 
Jim Ockers, P.Eng. (ockers at ockers.net)
Contact info: please see http://www.ockers.net/



More information about the clue-tech mailing list