redirect email to external mailbox?

hi,

how can i redirect mail from my server john@abc.com to external mailbox john@yahoo.com  ?

thanx
bsherAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jonkeCommented:
If using sendmail, create a file in his $HOME/mail diresctory called .forward.

In this file you want to put the address you wish to forward mail onto. Also chmod 644 .forward.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bsherAuthor Commented:
if i don't want to create the user john, but i still need to create john@abc.com and redirect to external mailbox,

what should i do?

And, is there any way to do that, besides adding the .forward,
eg: can i just modify the virtusertable or ?

Thanx for helping.
bsh
0
jonkeCommented:
Ok- You won't need to create a john@abc.com on the mailhost. Instead:-

Create an alias in /etc/aliases. e.g. put the entry,

john : john@external.address
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

bsherAuthor Commented:
if i send a mail to john@abc.com, it'll redirect to john@yahoo.com ?

just need to add the entry to /etc/aliases ? thats all?
0
jonkeCommented:
Yup:

john : john@yahoo.com

As long as the mailhost receives a mail for john, it will do an alias lookup and forward it on.

You can do all sorts of stuff with /etc/aliases. For example, if I send a mail to pipeme@mailhost, and put this entry in /etc/aliases:

pipeme : " |/a_script/somewhere.sh"

I can pipe a mail into a shell script.
0
bsherAuthor Commented:
i m not only hosting abc.com, so can i just add
john : john@yahoo.com or

john2@def.com : john@yahoo.com ?

0
bsherAuthor Commented:
i m not only hosting abc.com, so can i just add
john : john@yahoo.com or

john2@def.com : john@yahoo.com ?

0
jonkeCommented:
As long as it is the mails  final delivery point you can use this

john : john@yahoo.com

e.g. You wouldn't be able to put this on a mail relay and have it intercept the mail as it passes through on its way to abc.com / def.com. That would be a big security loophole
0
bsherAuthor Commented:
even i dont need to create john@abc.com , but i still need to create user 'john' on my linux, am i right?

if so, it is posibble just adding john : john@yahoo.com to virtusertable table?

Thax alot for helping
bsh
0
jonkeCommented:
You shouldn't have to add a user john or create a john@abc.com.

This answer works for unix running sendmail. I do not know enough about linux to say this will work, although, try

# ps -ef |grep sendmail

To see if it running sendmail- you should see something like:

  root   231     1  0   Jan 14 ?        0:02 /usr/lib/sendmail -bd -q15m

If it is, then do:

#grep alias /etc/mail/sendmail.cf

and look for a line in the output like:

O AliasFile=dbm:/etc/mail/aliases

This is where the alias file is, and this is the file that needs editing.

0
bsherAuthor Commented:
will the mail redirect to john@yahoo.com if i just put john : john@yahoo.com ?

how will it know john belongs to @abc.com ? if there have john@xyz.com? both of them will redirect the mail ?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.