Messaging
cancel
Showing results for 
Search instead for 
Did you mean: 

moving mail from sendmail to another server

Fred Martin_1
Valued Contributor

moving mail from sendmail to another server

We recently sold a subsidiary company. The users had email inboxes on my sendmail server, in /var/mail.

They've just set up their own mail server finally, an Exchange box apparently. Anyway I have no access to it; they're a different company now.

I do have some 'leftover' email on my server though, which I'd like to forward on to the users at the new place before it gets stale.

As you'd expect the users may have more than one message in the /var/mail file.

If I just do something like this:

mailx newbox@newcompany.com < /var/mail/oldbox

...it arrives alright, but not how you'd like. The whole previous header is part of the message body, etc. and I have to break the inbox down into individual messages and send each, and they're ugly to boot.

Is there a way to deliver this email inbox so that it arrives at the new server as individual emails for the user, in somwthing similar to what they'd see if they just pop'd into my box to get it?

I've a suspicion that I should not be using mailx but probably sendmail in some mode that just transfers the mail.

Fred
fmartin@applicatorssales.com
8 REPLIES
rleon
Regular Advisor

Re: moving mail from sendmail to another server

How were the users downloading mail before the cut over?

I am sure the domain no longer points to the old mailserver but they should still be able to access with an IP and download and archive all of their mail.
Fred Martin_1
Valued Contributor

Re: moving mail from sendmail to another server

They were using pop3 to get mail before, but they were also a subnet on our network. The physical network is no longer available, they're in a separate building and we only have the internet between us now.

In fact the admin over there spent the weekend setting up each user with a new Outlook config that points to their own (new) Exchange server.

Fred
fmartin@applicatorssales.com
rleon
Regular Advisor

Re: moving mail from sendmail to another server

Ok so what mail is still left? If they were using pop3 they downloaded at lest a copy of their mail.

If they flagged in outlook "keep copy on server" the email would still be their mailbox even if it was downloaded.

You can also put the server online with a public ip and allow them to download their mail.
Fred Martin_1
Valued Contributor

Re: moving mail from sendmail to another server

Our server was masquerading for their domain name up until the weekend.

The users went home at 4pm Friday. Over the weekend they got the new server and the network link between us was disconnected. The admin over their set them up on the new server and then set the public MX record to point to their domain, now a different IP than ours.

So, any email sent to those users between 4pm Friday and time that the MX record was finally propagated, landed on our server and not theirs.

Perhaps some better planning between us might have allowed this to be more smooth but there it is.

Anyway - expecting the users to change their Outlook settings to pop in to the old server would be a cluster I'm afraid, and I'd have to allow them in through our firewall to do it.

I really am looking for a way for me to just bounce the stuff over there.
fmartin@applicatorssales.com
Fred Martin_1
Valued Contributor

Re: moving mail from sendmail to another server

And actually, when there is only one email in the /var/mail file ("oldbox") this seems to work well:

# sendmail -ba newbox@newcompany.com < /var/mail/oldbox

But if there are multiple messages in there only appears to send the first.

I suppose I could write a script to parse out each message and send them individually.

Fred
fmartin@applicatorssales.com
Dennis Handly
Acclaimed Contributor

Re: moving mail from sendmail to another server

>I suppose I could write a script to parse out each message and send them individually.

Why bother. Simply attach the whole mailbox to a message and then send that. Let them import the messages into their new mail format.
rleon
Regular Advisor

Re: moving mail from sendmail to another server

Yeah .. it seems that there is no real elegant solution for this.

Do a google search for mailstore .. it is a free email archiving program.

You will have to download each users mailbox individually to break up the messages but it may get the job done.

I did a google search for "read email on unix system" and "export email from unix" and several options came up. Looks like one of them may work for you.
Fred Martin_1
Valued Contributor

Re: moving mail from sendmail to another server

As it turns out, I did write a shell script, it's only 30 or so lines. It parses a /var/mail/file into individual email messages, placing each into a temp file as it goes, and does a sendmail -ba on the temp file to the person's new address at the other company.

All done.

As regards whether or not to bother - in another case I'd agree the issue is theirs and I could have sent the inboxes to the new admin over there and let them deal with it. But as it turns out - we don't own them any more but we're now the biggest customer for their product so we still have to play nice.

Fred
fmartin@applicatorssales.com