[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 348
  • Last Modified:

redirect email to external mailbox?

hi,

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

thanx
0
bsher
Asked:
bsher
  • 6
  • 5
1 Solution
 
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
 
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
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

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now