procmail
[Top] [All Lists]

Re: SMS forward, limiting characters

2004-03-07 05:51:39
Timothy J. Luoma wrote:

Summary: My SMS provider is not honoring Errors-To and is bouncing messages which are forwarded which are too long for it to handle. This means that people are getting bounces from forwards to my cell phone and then they think their message did not get through.

My SMS recipe has been this


:0c
<conditions for sms forwarding here>
{
        :0fhw
        |formail -I"Precedence: junk" -I"Errors-To: luomat(_at_)peak(_dot_)org"

        :0
        * ^^From \/[^ ]+
        ! -f "$MATCH" $CELLSMS
}

where "$CELLSMS" is previously defined as my cell SMS address.

This *should* prevent anyone but me from seeing when things go wrong (if I
am understanding the Errors-To: line correctly).  However, apparently if
the message is too long people are getting bounce messages.

1) Are there other headers I can use to prevent bounces?
You could send the message by calling sendmail with your address as the SMTP envelope, bounces would then come to you (and you can filter them)

2) Is there a way to limit the body of the message to 200 characters?

I've thought about doing something like this, but it seems ugly:

        :0fbw
        |grep -v "^>" | grep -i "[a-z]" | head -10

the first grep is to remove quoted lines, the second is to match non-blank lines, and then just grab the first 10 lines of whatever is left.
Something like

formail -I"" | grep -v "^>" | perl -e "$/ = undef; $_ = <>; s/\s+/ /sg; print substr $_, 0, 200"

should do -- extract the body, filter quoted lines, replace whitespace with single spaces and select the first 200 characters.

3) Is there a way to preserve the From: without the ^^From hack above (perhaps something which would be enough to prevent bounces from going to the original sender?)

See 1)

--
Klaus Johannes Rusch
KlausRusch(_at_)atmedia(_dot_)net
http://www.atmedia.net/KlausRusch/



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>