?
Solved

Mail forwarding syntax in .forward and/or procmail

Posted on 2003-03-21
13
Medium Priority
?
1,072 Views
Last Modified: 2012-05-04
Hello,

I have an ISP email account which has numerous email addresses forwarded to it.  I need to forward all mail destined for a particular address to multiple addresses.  My shell account has procmail installed, but I'm wondering if I can do this with a .forward file?  If you could provide syntax for the simplest way to accomplish this, I'd be most grateful.  (I don't know much about procmail, except that it can probably do what I'm asking.)

So, to recap, I'd like all mail that comes into my shell account for foo@blah.com, to be automatically forwarded to name@domain.com, name@domain2.com and name@domain3.net.

Any ideas?  Thanks in advance...
0
Comment
Question by:Fozzy_2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 3
  • +1
13 Comments
 

Expert Comment

by:Alee
ID: 8184880
Create the .forward file in you home directory.  Double check you home directory with command "echo ~".  Enter each email address on a different line.

your /home/foo/.forward file should look like this:
name@domain.com
name@domain2.com
name@domain3.net
0
 
LVL 38

Expert Comment

by:yuzh
ID: 8186073
If you want to keep a copy of the eamil in your ISP server and forward the mail to the others, the .forward file looks like:

YourISPloginName, name@domain.com, name2@abc.net


0
 

Author Comment

by:Fozzy_2000
ID: 8192282
Thanks for the suggestions... I may need to clarify something though.  

Say, for example, the actual shell account name is "shellact".  Which would make the 'main' email address "shellact@shell.isp.com".  Now, through my DNS provider, I have a bunch of addresses forwarded to this account.  For example, let's say "foo@blah.com", "foo2@blah.net" and "foo3@blah.org" all forward to "shellact@shell.isp.com".

I *only* want to forward the email that comes into my shell account destined for "foo@blah.com".  Again, I want the email destined for foo@blah.com to be forwarded to multiple recipients: "name@domain.com", "name@domain2.com" and "name@domain3.net". I want the other forwards (foo2@blah.net and foo3@blah.org) to be received in the shell account as they already are.

An example of this application would be if I had an online ordering service and I wanted new orders to be forwarded to the various order-filling people (using the above example, all new orders would be sent to foo@blah.com).  Yet, I also wanted to receive my regular email at this same account (and of course didn't want that to be forwarded to the order-filling ppl).

Sorry if I wasn't clear enough... thanks again!
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 38

Expert Comment

by:yuzh
ID: 8192611
In this case, you need to write a filter script to handle the job.

your .forward file would looks like:

\shellact, "|/home/shellact/bin/mymail-filter"

In your "mymail-filter", you need to do the following things:

1. Catch the incoming email and store it in a tmp file.

2. Check if the mail is  for who, and process:

case "$RECEIVEDADD" in
  "foo@blah.com")
       mail the tmp file to whoever you want
;;
   * )
       #do nothing, and the mail keep in your mail box
       ;;
esac  

   I hope that the above infor can help.

   Have a look at my script in the following question, it should give you some idea on how to catch an incoming eamil and process it. (I ansered the question myself, cost you no points )

    http://www.experts-exchange.com/Networking/Email_Groupware/Sendmail/Q_20319762.html

   Cheers!

0
 

Author Comment

by:Fozzy_2000
ID: 8197259
Thanks for the info... I have no idea how to read that shell script that you posted, but I'll try to analyze / implement it.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 8199710
The script I wrote is for email auto-reply, not 100% want you want for you case.

If you don't know how to write a script, you can try to post a 500+ point question in UNIX programming TA, to see if any one want to spend some time to write one for you case (required know the email format and skill in shell script).

If you want to do it yourself, and you get stuffed in some point, you can post a commet here, I'll give you a hand.
0
 
LVL 20

Expert Comment

by:Gns
ID: 8202345
Um, why haven't anyone done the procmail thing?

Yuzhs' mailfilter is good enough, true, but ... since you have procmail...
Is promail run globally, or called through the .forward file? If via .forward, then put
"|IFS=' '&&p=/usr/bin/procmail&&test -f $p&&exec $p -Yf-||exit 75 #YOUR_USERNAME"
in that file.

Create the file .procmailrc in your home directory, with content like this (you might want to set PATH, MAILDIR etc etc. Look at the excellent examples in man procmailex):
:0
* ^TOfoo@blah.com
! name@domain.com name@domain2.com name@domain3.com

-- Gl
0
 
LVL 38

Accepted Solution

by:
yuzh earned 750 total points
ID: 8207525
If you want to try the procmail thing, have a look at the following tutorial:

http://pegasus.rutgers.edu/~elflord/unix/procmail.html

0
 
LVL 20

Expert Comment

by:Gns
ID: 8209029
Thanks yuhz... That was an (incomplete) accidental post by me (as can be seen by it's ... incompleteness:-).
The tutorial is great (as is the man-pages;-).

I've used procmail to accomplish exactly this kind of thing in the past... it works like a charm. I warmly recommend you to try.

-- Glenn
0
 
LVL 38

Expert Comment

by:yuzh
ID: 8209739
I did read something about procmail in the past, I mainly interested in the auto-reply, from my memory the auto-reply is call the vacation program to do the job.

Unfortunately, vacation cannot handle my network situation (I have subnet,sub-subnet, as show in my link), that's why I endup wrote that script to do the job.

I think procmail might be good enough for Fozzy_2000's case.

Cheers!

0
 

Author Comment

by:Fozzy_2000
ID: 8317187
Thanks for the info and all of the responses.  It looks like procmail is the way that I'll be going.
0
 
LVL 20

Expert Comment

by:Gns
ID: 8319563
Good choice.
Have fun
-- Glenn
0
 
LVL 38

Expert Comment

by:yuzh
ID: 8326632
Hi Gns,

   You are the first one to make the suggestion to use procmail.

   To make it fair, I post the a question at:

http://www.experts-exchange.com/Operating_Systems/Unix/Q_20584485.html

   Cheers!

0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question