Re: Sending a new email with maildrop/mailbot

Larry Stone <[email protected]>
Newsgroups gmane.mail.maildrop
Message-ID <[email protected]>
On Dec 5, 2013, at 7:20 PM, Sam Varshavchik <[email protected]> wrote:

> Larry Stone writes:
> 
>> On Dec 5, 2013, at 6:49 PM, Sam Varshavchik <[email protected]> wrote:
>> 
>> > if (/^From:.*REDACTED/ && \
>> >  /^Subject:.*key subject/ && /.*key text.*/:b)
>> > {
>> >     cc "| (echo 'From: [email protected]'; echo 'Subject: key'; sed -n '/^From:/d;/^Subject:/d;1,/^$/p';"' echo "$MATCH") | /usr/sbin/sendmail -f "" [email protected]'
>> > }
>> 
>> 
>> Hmmm. Never even thought about building a message on the fly and just piping it to sendmail. But sure, that would work. But is something missing there? I know little about sed (always found other ways to do things) but where is $MATCH getting defined?
> 
> The maildropfilter man page – it describes how $MATCH gets set; also mentions that when running an external command, maildrop's variables get exported as environment variables.

Stared at that man page and never saw it. :-(

Anyway, not quite what I needed but it put me on the right track. I don’t just need the match text in $MATCH, I need the whole line it was in. The “key text” string is the key to the correct line in the file.

What I ended up with is:
{
    MSGTEXT = `grep -i “key text"`
    cc "| (echo "From: $SENDER"; echo "To: $PHONE"; \
       echo "Subject: $SUBJECT"; echo ""; echo $MSGTEXT) | \
       /usr/sbin/sendmail $PHONE”
}

No temporary file and it doesn’t use mailbot which wasn’t quite generating the mail I wanted (although it worked for my purposes).

So all in all, thanks for the quick help.

-- 
Larry Stone
[email protected]
http://www.stonejongleux.com/

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk

_______________________________________________
Courier-maildrop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/courier-maildrop
smime.p7s (application/pkcs7-signature, 4.1 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.