LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-04-2012, 07:33 AM   #1
anurag2202
LQ Newbie
 
Registered: Aug 2010
Posts: 20

Rep: Reputation: 0
Email forwarding in postfix mail server


Hi

Can someone help me out to do email forwarding in postfix mail server.
Postfix is configured and working fine as i am able to send/receive mails from the same.

Thanks
Anurag
 
Old 07-04-2012, 07:41 AM   #2
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
Hi there,

Please elaborate a little on what you want to do. Are you trying to forward mail for a specific user to another address? All mail to a different server or domain?

Regards,

Clifford
 
Old 07-04-2012, 07:50 AM   #3
anurag2202
LQ Newbie
 
Registered: Aug 2010
Posts: 20

Original Poster
Rep: Reputation: 0
Hi

For eg. i have configured mail server with a domain intelligence.com and hostname mail.intelligence.com.
Now i want whatever mails receive within this domain needs to be forwarded to my personal email id anurag2202@gmail.com.

So, what changes i needs to do to forward, received mails to my personal one....

Thanks
 
Old 07-04-2012, 07:52 AM   #4
jsaravana87
Member
 
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558
Blog Entries: 5

Rep: Reputation: Disabled
Hi cliffordw,
First of all you does not ellaborate what you want to achieve. If you want to receive all the incoming message to forward to single Email address. Then you have to configure catch all configuration .

First, set the following directives in /etc/postfix/main.cf:

virtual_alias_maps = regexp:/etc/postfix/virtual
virtual_alias_domains =

Second, edit /etc/postfix/virtual to send everything to your catchall address:

/.*/ catchall@gmail.com

Now rebuild the map file and restart postfix:

# postmap /etc/postfix/virtual
# /etc/rc.d/postfix restart

Test your setup by sending mail to some random address. It should arrive at your catch-all address. Watch /var/log/mail.log for success/errors.

$ echo "testing" | mail -s "test" john@example.com

First, set the following directives in /etc/postfix/main.cf:

virtual_alias_maps = regexp:/etc/postfix/virtual
virtual_alias_domains =

Second, edit /etc/postfix/virtual to send everything to your catchall address:

/.*/ catchall@gmail.com

Now rebuild the map file and restart postfix:

# postmap /etc/postfix/virtual
# /etc/rc.d/postfix restart

Test your setup by sending mail to some random address. It should arrive at your catch-all address. Watch /var/log/mail.log for success/errors.

$ echo "testing" | mail -s "test" mail@example.com

First, set the following directives in /etc/postfix/main.cf:

virtual_alias_maps = regexp:/etc/postfix/virtual
virtual_alias_domains =

Second, edit /etc/postfix/virtual to send everything to your catchall address:

/.*/ catchall@gmail.com

Now rebuild the map file and restart postfix:

# postmap /etc/postfix/virtual
# /etc/rc.d/postfix restart

Test your setup by sending mail to some random address. It should arrive at your catch-all address. Watch /var/log/mail.log for success/errors.

$ echo "testing" | mail -s "test" mail@example.com
 
Old 07-05-2012, 07:04 AM   #5
anurag2202
LQ Newbie
 
Registered: Aug 2010
Posts: 20

Original Poster
Rep: Reputation: 0
Well Sir u r correct, but by using catchall@gmail.com, all the emails sent to not existing email id's will also come to catchall directory or to the user whose id is in catchall but my concern is a bit different. I can elaborate a bit more...

I configured postfix mail server and working fine. I can send/receive using the same to/from any domain.
Suppose, there is a user created on postfix mail server anurag@intelligent.com. My concern is if i am sending mails to anurag@intelligent.com from my personal id anurag@gmail.com, then such mails should also forward to my other email id i.e. anurag2202@gmail.com.

Thanks
Anurag
 
Old 07-05-2012, 08:32 AM   #6
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
Hi again,

Am I correct in understanding that you want to do this for select email addresses only, and not globally for all users?

If so, you probably only need an alias (in /etc/aliases) or a ~/.forward file.

Regards
 
Old 07-05-2012, 09:01 AM   #7
jsaravana87
Member
 
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558
Blog Entries: 5

Rep: Reputation: Disabled
Hi
As cliffordw says you can achieve the thing using alias.It just forward the mail from one user to another .

# vi /etc/postfix/aliases
arunrag :arunrag@gmail.com

#sudo newaliases

# sudo postfix reload


check whether alias in your postfix configuration

# postconf -n|grep -i alias

Last edited by jsaravana87; 07-05-2012 at 09:03 AM.
 
Old 07-05-2012, 11:22 PM   #8
anurag2202
LQ Newbie
 
Registered: Aug 2010
Posts: 20

Original Poster
Rep: Reputation: 0
Hi Cliffordw

As you suggested me to do an aliases thing. I configured postfix but aliases file does not exist in /etc/postfix.
I created it manually and did the same thing as you suggested me but the output is same i.e. mails are sending/receiving fine but not forwarded.

Please suggest.

Thanks
Anurag
 
Old 07-10-2012, 03:51 AM   #9
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
The aliases usually exists by default, but its default location might differ depending on your distribution. For some distros it is in /etc/postfix/aliases, and for others in /etc/aliases. There may be other possibilities too. Check for the alias_maps setting in your /etc/postfix/main.cf file for the location.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Email being traced/monitored (postfix mail server) grant-skywalker Linux - General 5 04-01-2011 05:09 AM
Mail Server with : Postfix,dovecot. (Can send email, but can't receive email from internet mail) cparapat Linux - Server 1 08-16-2010 12:57 AM
Mail Forwarding in postfix/maildrop/redhat (like yahoo mail forwarding) topcat Linux - Software 1 08-31-2007 12:10 PM
cannot receive email from mail server installed with postfix charles168 Linux - Software 4 08-15-2003 02:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration