🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #68059

Re: mail2news question

#68059
From: Dr.Ruud
Date: Wed, 11 Feb 2004 03:26
132 lines
4773 bytes
Toen ik Lolodirezo kietelde, kwam er dit uit:

> Thanks a lot for your very goods informations.
> google: procmail lynx dump give me a marvellous article about
> /etc/procmailrc.

Be careful with /etc/procmailrc, it runs as root.
Normally you would use a .procmailrc (dot-promailrc)
in the user's home. See als DROPPRIVS in man procmailrc.

Did you find this?
http://www.xray.mpe.mpg.de/mailing-lists/procmail/2002-06/msg00291.html


> my mail2news works when the mail sent with ximin evolution  in html
> mode but with mozilla mailer oo outlook express
> i got an error (extract from /var/log/procmail.log):
>
> munpack: reading from standard input
> Can't send article to the server:
>         441 437 EMP rejected (ph/l)
> (Article not posted.)
> procmail: Program failure (1) of " munpack -t -C $DIR && \
> lynx -dump -force_html $DIR/part1 | \
> /mail2news.pl mygroup "$SUBJ" "$FROM" && \
> rm -r $DIR/*"
>
> my /etc/procmailrc:
> SUBJ=`formail -c -xSubject:`

or (more efficiently)
  :0
  * ^Subject:[  ]\/[^  ].*
  { SUBJ = $MATCH" }
(where both [  ] and [^  ] contain a literal space and tab)

> FROM=`formail -c -xFrom:`

For how to get a clean From:address, see
  http://www.professional.org/procmail/sandbox.html


> DIR=/var/.../myemail/.procmail
> :0w
> * ^TOmyemail@mydomain.fr

The ^TO_ macro is better for full addresses.
See man procmailrc for the difference.


> {
>   :0wb
>   * ^Content-Type: text/html.*
>   | lynx -dump -foce_html -stdin | \
>     /mail2news.pl mygroup "$SUBJ" "$FROM"

fo[r]ce_html ?

Add LOGging:

NL="
"
TAB="    "  # a literal tabcharacter (ASCII-9) between ""

   :0
   * ^Content-Type: text/html
   {
     LOG =
"$$${TAB}S:${SUBJ}${NL}${TAB}F:${FROM}${NL}${TAB}C:text/html${NL}"
     :0wb
     | lynx -dump -force_html -stdin | \
       /mail2news.pl mygroup "$SUBJ" "$FROM"
   }


>   :0w
>   * ^Content-Type: multipart/alternative.*
>   | munpack -t -C $DIR && \
>     lynx -dump -force_html $DIR/part2 | \
>     /mail2news.pl mygroup "$SUBJ" "$FROM" && \
>     rm -r $DIR/*
>
>   :0w
>   * ^Content-Type: multipart.*
>   | munpack -t -C $DIR && \
>     lynx -dump -force_html $DIR/part1 | \
>     /mail2news.pl mygroup "$SUBJ" "$FROM" && \
>     rm -r $DIR/*
> }

There is no need for a .* at the end of any condition line,
unless the \/ match-operator is used.
Make sure that there are no spaces after any continuation-backslash.


> i modified mail2news because after filters (munpack and lynx), i lost
> the subject and the from (so i save the values in /etc/procmailrc to
> restore then in mail2news.pl)
>
> have you got an idea ?

Not yet. Maybe the 'rm -r' fails, did you try 'rm -f'?

Check the logs of the newsserver about the
  441 437 EMP rejected (ph/l)

The first recipe doesn't use $DIR, is that the one
that evolution uses?

I assume that your directory /var/.../myemail/.procmail
exists. (see also MAILDIR in man procmailrc)

Try Sean's sandbox-approach first.

Put the 'rm -f $DIR/*' in TRAP.

Add some LOG="$$ blabla$NL" lines to your recipes,
where NL is defined as:

NL="
"

Use $$ (the PID) as part of temporary filenames,
but better try to get rid of any temp-files at all
(which needs a munpack-version that can put a specified
part on stdout). (or use lockfiles, several procmails
can and will run concurrently)

-- 
Affijn, Ruud

Technical Details
Message-ID: <c0cau0.1cs.1@news.isolution.nl>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!intern1.nntp.aus1.giganews.com!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!nntp.giganews.com!amsnews01.chello.com!news2.euro.net!blue.qinip.net!transit.news.xs4all.nl!not-for-mail
References: <92f11979.0402040345.125543fc@posting.google.com> <bvshvc.128.1@news.isolution.nl> <92f11979.0402050225.4fc95833@posting.google.com> <bvtshc.1k8.1@news.isolution.nl> <92f11979.0402101355.76789454@posting.google.com>

Show Full Headers
Complete Article Headers
Message-ID: <c0cau0.1cs.1@news.isolution.nl>
Subject: Re: mail2news question
Date: Wed, 11 Feb 2004 04:26:22 +0100
From: "Dr.Ruud" <'t.leven.is.fijn@life.i$.great>
References: <92f11979.0402040345.125543fc@posting.google.com> <bvshvc.128.1@news.isolution.nl> <92f11979.0402050225.4fc95833@posting.google.com> <bvtshc.1k8.1@news.isolution.nl> <92f11979.0402101355.76789454@posting.google.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!intern1.nntp.aus1.giganews.com!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!nntp.giganews.com!amsnews01.chello.com!news2.euro.net!blue.qinip.net!transit.news.xs4all.nl!not-for-mail
Reply-To: "Dr.Ruud" <(rvtol+news(AT)hacktic.nl) Administrator@[127.0.0.1]>
Newsgroups: news.software.nntp
Organization: Chaos rules.
X-Newsreader: WMDIYA
Approved: yesterday
X-Face: &CQ$FIr!=+=w,8`0Q^Ug"1>F[(/op8->E; NQet`5fe$;
 =e*!Z5&REvp<~Tj|"Y[|8OcJ{w#z&mB7B:I)XO*%_|\]|YW$C>>$Q[9-#K~c$tQ^Mf0,wMo?h\C)TE>f
Lines: 132
NNTP-Posting-Date: 11 Feb 2004 04:31:36 CET
NNTP-Posting-Host: 194.109.164.102
X-Trace: 1076470296 news.xs4all.nl 569 [::ffff:194.109.164.102]:33227
X-Complaints-To: abuse@xs4all.nl