resend messages

resend messages

am 02.04.2005 13:01:26 von Jean Magnan de Bornier

Hello all,
Setup: Linux, postfix, procmail
Due a config mistake, messages for a user have been sent to
/var/mail/ instead of to his box /home/user/.maildir/
How can I resend those messages to the correct location?
tia,
--
Jean Magnan de Bornier | Cours Victor Hugo
e-mots: jean at bornier.net | 13980 Alleins France
T 08 70 39 34 03 | P 06 09 17 35 87

Re: resend messages

am 02.04.2005 14:07:54 von Alan Connor

On comp.mail.misc, in <873bu9tpbt.fsf@borlap.bornier.net>, "Jean Magnan de Bornier" wrote:
>
>
> Hello all,
> Setup: Linux, postfix, procmail
> Due a config mistake, messages for a user have been sent to
> /var/mail/ instead of to his box /home/user/.maildir/
> How can I resend those messages to the correct location?

The problem being that /var/mail/user is mbox and the
user's box is maildir.

This should work:

cat /var/mail/user | /usr/bin/formail -ds \
/usr/bin/procmail /home/user/proctemp

~/proctemp:

Standard
Environmental
Vars
Here

:0
/home/user/.maildir/

You might want to let procmail create a test directory
first, like /home/user/foo/, to see whether that works.
wouldn't want to trash the users mailbox.

Not sure whether you need to remove the Status flags in
the mbox or not. If so, just run it through sed before
formail:

sed '/^Status/d' /var/mail/user | /usr/bin/formail....

I'd su to the user rather than doing this as root.


HTH,

AC

--
Zero-Tolerance for Spam and Trollmail
Pass-list --> Block-List --> Challenge-Response
http://tinyurl.com/2t5kp

Re: resend messages

am 02.04.2005 15:39:02 von Jean Magnan de Bornier

Alan Connor wrote :

> On comp.mail.misc, in <873bu9tpbt.fsf@borlap.bornier.net>, "Jean Magnan
de Bornier" wrote:
>>
>>
>> Hello all,
>> Setup: Linux, postfix, procmail
>> Due a config mistake, messages for a user have been sent to
>> /var/mail/ instead of to his box /home/user/.maildir/
>> How can I resend those messages to the correct location?
>
> The problem being that /var/mail/user is mbox and the
> user's box is maildir.
>
> This should work:
>
> cat /var/mail/user | /usr/bin/formail -ds \
> /usr/bin/procmail /home/user/proctemp
>
> ~/proctemp:
>
> Standard
> Environmental
> Vars
> Here
>
> :0
> /home/user/.maildir/
>
> You might want to let procmail create a test directory
> first, like /home/user/foo/, to see whether that works.
> wouldn't want to trash the users mailbox.
>
> Not sure whether you need to remove the Status flags in
> the mbox or not. If so, just run it through sed before
> formail:
>
> sed '/^Status/d' /var/mail/user | /usr/bin/formail....
>
> I'd su to the user rather than doing this as root.

cannot su to user, it's a server with no shell for users!
right now, as root, couldn't get any result (messages copied into
/var/mail/root)
reading man formail, hope to find a way...
thanks,
--
Jean Magnan de Bornier | Cours Victor Hugo
e-mots: jean at bornier.net | 13980 Alleins France
T 08 70 39 34 03 | P 06 09 17 35 87

Re: resend messages

am 02.04.2005 21:10:56 von Alan Connor

On comp.mail.misc, in <87u0mps3gp.fsf@borlap.bornier.net>, "Jean Magnan de Bornier" wrote:
>



>
> cannot su to user, it's a server with no shell for users! right
> now, as root, couldn't get any result (messages copied into
> /var/mail/root) reading man formail, hope to find a way...
> thanks,

That makes no sense at all. How could the mails end up in
/var/mail/root when you specified /home/user/.maildir?

What are the environmental vars at the top of your temporary
procmailrc?

AC

Re: resend messages

am 02.04.2005 21:14:57 von Jem Berkes

> Hello all,
> Setup: Linux, postfix, procmail
> Due a config mistake, messages for a user have been sent to
> /var/mail/ instead of to his box /home/user/.maildir/
> How can I resend those messages to the correct location?
> tia,

You already have the mail delivered to /var/mail/user and formail can split
up a mailbox file. I think you should be able to do (untested),

grep -v ^Delivered-To: /var/mail/user | formail -s sendmail user

This will first remove postfix's Delivered-To: headers (otherwise you'll
get delivery loop failures), then invoke postfix's sendmail command to send
each message as a new email to the user.

Caveats:
- You might have to use sendmail -i switch, I'm not sure
- You might have to also remove the X-Original-To: header

Good luck,

--
Jem Berkes
Software design for Windows and Linux/Unix-like systems
http://www.sysdesign.ca/

Re: resend messages

am 02.04.2005 22:20:12 von Jean Magnan de Bornier

Jem Berkes wrote :

>> Hello all,
>> Setup: Linux, postfix, procmail
>> Due a config mistake, messages for a user have been sent to
>> /var/mail/ instead of to his box /home/user/.maildir/
>> How can I resend those messages to the correct location?
>> tia,
>
> You already have the mail delivered to /var/mail/user and formail can split
> up a mailbox file. I think you should be able to do (untested),
>
> grep -v ^Delivered-To: /var/mail/user | formail -s sendmail user

Yes, this one is perfect

Thanks a lot!
--
Jean Magnan de Bornier | Cours Victor Hugo
e-mots: jean at bornier.net | 13980 Alleins France
T 08 70 39 34 03 | P 06 09 17 35 87

Re: resend messages

am 02.04.2005 22:24:12 von Jean Magnan de Bornier

Alan Connor wrote :

> On comp.mail.misc, in <87u0mps3gp.fsf@borlap.bornier.net>, "Jean
>Magnan de Bornier" wrote:
>>
>
>
>
>>
>> cannot su to user, it's a server with no shell for users! right
>> now, as root, couldn't get any result (messages copied into
>> /var/mail/root) reading man formail, hope to find a way...
>> thanks,
>
> That makes no sense at all. How could the mails end up in
> /var/mail/root when you specified /home/user/.maildir?
procmail couldn't find where to deliver mail, so it put it in who gave the
command default mbox (root)
>
> What are the environmental vars at the top of your temporary
> procmailrc?
That means there probably was one more fault there
Thanks for your help
--
Jean Magnan de Bornier | Cours Victor Hugo
e-mots: jean at bornier.net | 13980 Alleins France
T 08 70 39 34 03 | P 06 09 17 35 87

Re: resend messages

am 02.04.2005 23:49:15 von Alan Connor

On comp.mail.misc, in <878y41rkpf.fsf@borlap.bornier.net>, "Jean Magnan de Bornier" wrote:



> Thanks for your help

No problem. If it was me, and I was going to do it Jem's way,
I'd strip off every nonessential header before delivering
the mail to $SENDMAIL.

formail -s sed '1,/^$/{/^Received:/d;/^Date:/d;}' |...

(Add rest of non-essential headers to the script.)

And use formail -A to add a header that indicated that there had
been a problem, (because the Received headers and Date, etc.,
are going to be quite different than they were in the original
mails). Maybe write up an account and:

.... | formail -A"X-Sysop: /root/account" | ...

So that you'd know where to look if you got any complaints.

Forwarding with procmail "! user's-email-address" might be
better than calling $SENDMAIL directly. It would at least
be clear that the path had been unusual. In that case, only
the -A thing with formail would be needed.

But all that probably isn't necessary.

Have a good one,

AC

Canonical list of questions Beavis refuses to answer (V1.10) (was Re: resend messages)

am 03.04.2005 00:18:03 von Sam

This is a MIME GnuPG-signed message. If you see this text, it means that
your E-mail or Usenet software does not support MIME signed messages.

--=_mimegpg-commodore.email-scan.com-16372-1112480283-0001
Content-Type: text/plain; format=flowed; charset="US-ASCII"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Beavis writes:

> On comp.mail.misc, in <878y41rkpf.fsf@borlap.bornier.net>, "Jean Magnan de Bornier" wrote:
>
>
>
>> Thanks for your help
>
> No problem. If it was me, and I was going to do it Jem's way,

Nobody cares, Beavis.

FAQ: Canonical list of questions Beavis refuses to answer (V1.10)

This is a canonical list of questions that Beavis never answers. This FAQ is
posted on a semi-regular schedule, as circumstances warrant.

For more information on Beavis, see:

http://angel.1jh.com/nanae/kooks/alanconnor.shtml

Although Beavis has been posting for a long time, he always remains silent
on the subjects enumerated below. His response, if any, usually consists of
replying to the parent post with a loud proclamation that his Usenet-reading
software runs a magical filter that automatically identifies anyone who's
making fun of him, and hides those offensive posts. For more information
see question #9 below.

============================================================ ================

1) If spammers avoid forging real E-mail addresses on spam, then where do
all these bounces everyone reports getting (for spam with their return
address was forged onto) come from?

2) If your Challenge-Response filter is so great, why do you still munge
when posting to Usenet?

3) Do you still believe that rsh is the best solution for remote access?
(http://tinyurl.com/5qqb6)

4) What is your evidence that everyone who disagrees with you, and thinks
that you're a moron, is a spammer?

5) How many different individuals do you believe really post to
comp.mail.misc? What is the evidence for your paranoid belief that everyone,
except you, who posts here is some unknown arch-nemesis of yours?

6) How many times, or how often, do you believe is necessary to announce
that you do not read someone's posts? What is your reason for making these
regularly-scheduled proclamations? Who do you believe is so interested in
keeping track of your Usenet-reading habits?

7) When was the last time you saw Bigfoot (http://tinyurl.com/23r3f)?

8) If your C-R system employs a spam filter so that it won't challenge spam,
then why does any of the mail that passes the filter, and is thusly presumed
not to be spam, need to be challenged?

9) You claim that the software you use to read Usenet magically identifies
any post that makes fun of you. In http://tinyurl.com/3swes you explain
that "What I get in my newsreader is a mock post with fake headers and no
body, except for the first parts of the Subject and From headers."

Since your headers indicate that you use slrn and, as far as anyone knows,
the stock slrn doesn't work that way, is this interesting patch to slrn
available for download anywhere?

10) You regularly post alleged logs of your procmail recipe autodeleting a
bunch of irrelevant mail that you've received. Why, and who exactly do you
believe is interested in your mail logs?


--=_mimegpg-commodore.email-scan.com-16372-1112480283-0001
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBCTxobx9p3GYHlUOIRAtONAJ0SCkX5KXw33iykF/r3cgH3Y+mAEgCf XKiN
w5i9YdVvfx7LIeoYSDqFSQA=
=dair
-----END PGP SIGNATURE-----

--=_mimegpg-commodore.email-scan.com-16372-1112480283-0001--

Re: resend messages

am 03.04.2005 05:03:24 von Nobody

Alan Connor wrote in :

| formail -s sed '1,/^$/{/^Received:/d;/^Date:/d;}' |...

That will take out only the first text line of each Received: header.
Almost all Received: headers have continuation lines. It can be done
better within formail, and without forking sed for each message in the
input:

formail -I Received: -I Date: -s < input | rest_of_pipe_whatever_it_was

--
David W. Tamkin

The reply address is bluelighted until 0500 UTC on 10Apr2005.

Re: resend messages

am 03.04.2005 06:19:17 von Alan Connor

On comp.mail.misc, in , "DWT"
wrote:

> Alan Connor wrote in
> :
>
> | formail -s sed '1,/^$/{/^Received:/d;/^Date:/d;}' |...
>
> That will take out only the first text line of each Received:
> header. Almost all Received: headers have continuation lines.
> It can be done better within formail, and without forking sed
> for each message in the input:
>
> formail -I Received: -I Date: -s < input | \
> rest_of_pipe_whatever_it_was

Very good. Thanks, David.

AC

Re: resend messages

am 07.04.2005 23:15:08 von AK

Jean Magnan de Bornier wrote:

> Hello all,
> Setup: Linux, postfix, procmail
> Due a config mistake, messages for a user have been sent to
> /var/mail/ instead of to his box /home/user/.maildir/
> How can I resend those messages to the correct location?
> tia,

To alter the dafualt mail location in procmail, you might need to
recompile procmail and set the MAILSPOOLHOME to /.maildir/ I believe it
is in authenticate.c


check out mbox2maildir
http://www.google.com/search?hl=en&q=mbox2maildir&btnG=Googl e+Search

This will do what you need, convert a mailbox format into a Maildir/ format.

AK

Re: resend messages

am 08.04.2005 20:38:56 von Jem Berkes

> You already have the mail delivered to /var/mail/user and formail can
> split up a mailbox file. I think you should be able to do (untested),
>
> grep -v ^Delivered-To: /var/mail/user | formail -s sendmail user

Funny, I just had to do the exact same thing myself and the above does work
quite nicely, with Postfix.

--
Jem Berkes
Software design for Windows and Linux/Unix-like systems
http://www.sysdesign.ca/