Link to home
Start Free TrialLog in
Avatar of ajma
ajma

asked on

Creating a mail forwarding script

Hello. I need some help creating a script which will grab my e-mail headers and forward it to another e-mail address(to my cell phone).
I know my unix server has procmail to process mail stuff but I don't really have the time (or the know-how) to figure it out. If someone could write the script for me, I would be grateful (and will award points). If you need any information about the unix server, just ask..... Thanks.
Avatar of Julian Parker
Julian Parker
Flag of United Kingdom of Great Britain and Northern Ireland image

Most unix servers allow you to create a .forward file in your home directory.

The .forward file should just contain the email address of the person you need the mail to go to.

e.g.
Fred.Bloggs@somewhere.com

Give it a go, can't hurt!

J :)
Avatar of ajma
ajma

ASKER

I want it to only forward the headers.
I need it to parse the e-mail because my cell phone will only take 160 characters.
Also, I need it to save a copy on the server too.
Most cell phone email systems will only
forward first 160 characters including senders name
subject and first few characters of the message.

Even if you forward the full email, your cell phone
email system will truncate the message for you.

I just use .forward to forward the message.

..forward:

\localusername, phonenumner@cellphone-address
Avatar of ajma

ASKER

well, if the message is over 160, it truncates it to 5 messages. I don't want 5 messages coming in when I get an e-mail.

All I want is to know how to make the e-mail go thru a script so I can parse it to only send the subject and the from fields. (and possibly block spam...)
ok.. in that case.. someone has to write a procmai
script... Lemme see if I can get you one,
ASKER CERTIFIED SOLUTION
Avatar of jtittsler
jtittsler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ajma

ASKER

Thanks. Works well!

One last question:
what is the phone.cache thing?

phone.cache is just a database of message IDs.  The 'formail -D 8192 phone.cache' line causes it to remember recent last message IDs (up to a cache size 8192).  It returns "success" if a duplicate is found.  (The next stanza uses 'e', so it will happen only if the previous result was false... meaning no duplicate was found.)

If you aren't worried about duplicates, you could take out that bit:
:0 hc
 # don't forward daemon/error messages or mailing lists
* !^FROM_DAEMON
  ! me@phoneisp.com