NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: combining /var/mail files



On Thu, Aug 23, 2018 at 05:41:37PM +0000, steve%prd.co.uk@localhost wrote:
> During a change of ISPs this week, I had to run mail service on a
> remote VPS, and access emails there.   There must be gotchas if I
> simply append the mail files from the VPS to the existing
> corresponding files on our usual mail machine now it's got it Internet
> connection restored.  There are always gotchas.  Can someone identify
> them for me?

The mbox format is pretty forgiving.  The record separator is literally
'\n\nFrom '.  So if you're going to do something like:

   cat /var/mail/foo /var/mail/bar > /var/mail/foobar

Make sure that there's at least two newlines at the end of /var/mail/foo
so that the first email of /var/mail/bar doesn't get absorbed by the
last email of /var/mail/foo.

Easily accomplished by:

   cp /var/mail/foo /var/mail/foobar
   printf '\n' >> /var/mail/foobar
   cat /var/mail/bar >> /var/mail/foobar

-- 
. ___ ___  .   .  ___
.  \    /  |\  |\ \
.  _\_ /__ |-\ |-\ \__


Home | Main Index | Thread Index | Old Index