X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Message-ID: <37477537.E594BB5F@concentric.net> Date: Sat, 22 May 1999 23:25:43 -0400 From: Eric Durant X-Mailer: Mozilla 4.5 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.mail.misc Subject: Procmail: Forwarding to Text Messaging Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, I'm trying to write a .procmailrc which will forward incoming e-mail to my text messaging service. (I've read various topics in the FAQs and pm-tips page, but haven't been able to get my script working.) My mail is simply being delivered normally, so I assume there is an error in my .procmailrc. I want to redirect incoming e-mail to my text messaging e-mail address, limiting the body text to not much more than 200 characters (the limit my text messaging device will display -- the service will truncate, but I'm doing this as I want to avoid sending 50 or 100kB messages when only the first 200 characters will get through). For my first simple version, I simply limit the length of the headers + body to not much more than 500 characters. (I have a plan how to limit the body length independently of the headers, but I want to get the basics working first.) Here is my .procmailrc: --------------------------------------- 01) SHELL=/bin/sh 02) 03) :0 Whc 04) * $^To:.*$LOGNAME 05) * !^FROM_DAEMON 06) * !^X-Loop: me@myisp.com 07) | formail -k -X"From" -X"Date" -X"Subject" \ 08) | formail -A"To: mypager@xyz.com" -A"Precedence: junk" \ 09) -A"X-Loop: me@myisp.com" \ 10) | tail +2 \ 11) | awk "{ while(i<500) { print; i += length; next; } }" \ 12) | $SENDMAIL -oi -t --------------------------------------- Lines 3-6 and 12 come from a working vacation script (except in that case I specify a lock file on line 3), so I don't think anything is wrong with them. I've tested lines 7 through 11 on some standard test mail streams and the output appears correct. (I've tried using explicit paths to tail and awk on the suspicion that procmail could not find them, but that did not make any difference.) Line 7 strips all headers besides From, Date and Subject from the message and puts it in mailbox format. Lines 8-9 add the To field as the text messaging destination and Precedence and X-Loop headers (probably not necessary given exclusion of FROM_DAEMON on line 5, but I'm being paranoid about mail loops). Line 10 strips out the first line (the mailbox header). Line 11 accumulates lines until a 500 character limit is exceeded. (I'm assuming this will not truncate the headers, which is valid for my test cases.) Finally, it is all piped to sendmail in the standard way on line 12. So, any ideas as to what I'm doing wrong? Suggestions on simplifying my long line of pipes are also welcome. Thank You, Eric Durant --- Website: http://www.edurant.com/ ICQ: 9118339