reply to email with procmail

Red Squirrel

No Lifer
May 24, 2003
70,403
13,701
126
www.anyf.ca
If it's possible, how can I reply to an email using procmail, and have it reply using a text file? Been trying all sorts of tricks with |sendmail etc, no luck.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
I put 'procmail reply' into google and the first hit looks relevant, the main body of the message isn't in english but the procmail recipe and it's comments are.
 

Red Squirrel

No Lifer
May 24, 2003
70,403
13,701
126
www.anyf.ca
LOL well I tried that, but given I don't understand that language, how am I suppost to know what the recipie does? Not even sure what language it is so can't really translate.

And while getting it to send an email is not the easiest thing to find out how, making it send to the sender, rather then a static address, is even harder, that's the main part I need to figure out how. Maybe procmail has some kind of variables or something that I can plug in, but the documentation does not seem to cover much about variables, unless it's hidden in some other page with a weird name.

Did not know about the mail command though, I was trying with sendmail, so I just tried it with mail but still does not do anything it's not even showing any kind of error in the logs it's just ingoring it.

Is this the right way?

:0fw
|mail -s "News parse Failed" email_webmaster@borg.loc < /data/samba/shared/ryan/
applications/news_parser/bounce_email.txt

Just testing it with an internal address for now, that email is valid on my network.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
And while getting it to send an email is not the easiest thing to find out how, making it send to the sender, rather then a static address, is even harder, that's the main part I need to figure out how.

That's all in the first google hit, it uses formail to extract headers from the mail being processed.
 

Red Squirrel

No Lifer
May 24, 2003
70,403
13,701
126
www.anyf.ca
So formail is to extract headers? Even after looking at some code I still have no clue what's going on. I found a page that does exactly what I want, and this is the main code to do it, but I just have no clue what's even going on in that code. Only thing I reconize is the cat command which would dump the actual message.

| (formail -r
-I"Precedence: junk"
-A"From: $VACATION_SENDER"
-A"X-Loop: $VACATION_XLOOP";
cat $VACATION_MSG ) |
$SENDMAIL_CMD

The whole code is here, but I don't need all the fancy stuff just need to send an email to the sender.

http://www.clarkconnect.com/wiki/index...._-_Procmail_Vacation_Auto-Reply_Recipe

Also, they never define the $SENDMAIL var so I have no clue what's suppost to go there, and it's used in $SENDMAIL_CMD, and in that code I don't see how it's being sent to the sender since there's no variable with the sender's address being plugged into the sendmail command (which is non existent to begin with). I'm thinking the -A"From: $VACATION_SENDER" \ part actually takes what is in front of from: and puts it in that variable, but then again, maybe $VACATION_SENDER is already defined and being plugged in there, hard to tell.

Would all this be easier with maildrop? I was reading up on it, and the syntax makes way more sense, which would make things easier I think, but deploying it would be a different story given my mail system is all based on procmail (my bad mistake).



Oh and in case this helps this is my entire procmail file, don't mind the commented parts, that's all my (failed) attempts at making it send an email to a fixed address, until I can figure out how to make it use the sender's address instead of a static.

:0fw
| spamc

:0H
* ^subject:.*\[SPAM\]
/home/email_news/mail/spam

:0fw
|/data/samba/shared/ryan/applications/news_parser/parser.app

:0
* ^X-parse-status:.*fail
{
:0 c
!73424.iceteks.news.34785245353@gmail.com

:0
/home/email_news/mail/not-parsed

#:0fw
#|mail -s "News parse Failed" email_webmaster@borg.loc < /data/samba/shared/ryan/applications/news_parser/bounce_email.txt


#:0e
#|cat /data/samba/shared/ryan/applications/news_parser/bounce_email.txt | sendmail email_ryan@borg.loc

:0e
|sendmail email_ryan@borg.loc </data/samba/shared/ryan/applications/news_parser/bounce_email.txt

}



:0
*! ^X-parse-status:.*fail
/home/email_news/mail/parsed