NetBSD-Users archive

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

Re: combining /var/mail files



Izaac wrote in <20180823T201131Z@localhost>:
 |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

Yes.  This may of course an empty line to a message which did not
have one, but it is unlikely anyone would really care for that.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Home | Main Index | Thread Index | Old Index