Link to home
Start Free TrialLog in
Avatar of oceanis
oceanis

asked on

forward specific emails to a remote adress by using parameters

I use an email server on solaris and i forward emails that come in to another email (by request from some users)and at the same time i ceep copies to the local user's mail file.I have done this by writing in the ".forward" file (the .forward file is createt in the local user's mail directory) this line:

"user, user@remotesite.com"

(Accepted Answer from "shanechambers")


My question is, how can i use parameters to forward to the remote adress ("user@remotesite.com") only specific emails eg. incoming mails from a specific sender only

Thanks for your help!
Avatar of k.kidambi
k.kidambi

there is a file called /etc/mail/aliases. you have to add the alias entries for forwarding the emails the format looks like

usera      user-a@domain1.com
userb      user-b@domain2.com


try this out and post in here if you have anymore questions.

Kidambi
Ok, you want to forward email from certain users, on to another address, while keeping all others, in the local mailbox.  Is this right?

If so, what I would recommend is installing procmail (http://freshmeat.net/projects/procmail).  From there you would do the following;

In the .forward file;
|exec /usr/local/bin/procmail

In .procmailrc;
:0 c
* ^From.*peter
! william@somewhere.edu

This would keep a copy locally (if you don't want a local copy, drop the 'c' on the first line), and send a copy off to william@somewhere.edu, of all mail coming from 'peter' (note you don't need the @somewhere.edu after peter).

Procmail allows you to do a far greater 'conditional' setup for mail delivery then you normally would be able to do.  Take a look at the man pages for 'procmailex,' and 'procmailrc,' once you've got it installed.
Avatar of oceanis

ASKER

shanechambers is it easy to install procmail on solaris?
ASKER CERTIFIED SOLUTION
Avatar of shanechambers
shanechambers

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
How'd that work out?
Avatar of oceanis

ASKER

I finaly don't used it but thanks for your help shanechambers.
No comment has been added lately, so it's time to clean up this Topic Area.
I will leave a recommendation for this question in the Cleanup topic area as follows:

- Answered by shanechambers

Please leave any comments here within the next 7 days

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

tfewster
Cleanup Volunteer
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange