Stephen Allen wrote:
[...]
What I would like to be able to do is reply to her using fred's real
address. The way I thought of doing it was like this:
[...]
set the From: header to fred <fred(_at_)mydomain(_dot_)com>
set the To: header to the address contained within the first line of the
message
delete the first line of the message
send the message
Any ideas how I would attempt to do this?
Since the smarter procmail experts don't appear to have responded, I'll
submit my own lowly (but successful) attempt to do the same. Here's an
auto-responder, adapted from the procmail documentation vacation
responder, that I use to filter incoming messages through the Eliza perl
module. The body of the incoming message is stripped, then passed to
Eliza line-by-line for "analysis", and the response sent back from "Lucy
Mailpinger":
--- cut here --- cut here ---
#======================================================
# Implement e-mail mad chatter
#======================================================
:0
* ^TOlucy
* !^X-Loop: lucy
* ^Subject: \/.*
{
# Get sender (now recipient) address
FROM_=`formail -rt -xTo: \
| expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
# Let the madchatter work on the message body
# Strip html and clean up whitespace, then pass to Eliza
:0 cb:formail.lock
| /usr/bin/html2text -nobs \
| expand \
| sed -e 's/^[ ]*//g' \
| sed -e 's/[ ]*$//g' \
| /usr/local/bin/madchatter > return.tmp
# Send the response message
:0 c:formail.lock
| (formail -r -I"Subject: Re: $MATCH" \
-I "Cc: mailings(_at_)ttlexceeded(_dot_)com" \
-A "X-Loop: lucy"; \
cat return.tmp; \
rm -f return.tmp)\
| /usr/sbin/sendmail -t -F "Lucy Pingmailer"
}
--- cut here --- cut here ---
The reply comes back from "Lucy Mailpinger" with a message like:
--- cut here --- cut here ---
You wrote:
All of the news lately is just terrible.
Does talking about this bother you?
It seems that the world is coming to an end.
Tell me more about that.
--- cut here --- cut here ---
You can, of course, substitute the fun stuff with useful info. I've used
variants to:
1. Send back the original message, including headers, for a "mailping" and
verification of message handling.
2. Send back the current public IP of my otherwise-dynamic home system when
dyndns updates and the like fail.
Any comments or critique appreciated!
- Bob
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail