Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 23rd April 2010, 17:56
kongi123 kongi123 is offline
Junior Member
 
Join Date: Apr 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default PostFix: forward/redirect All emails to another fixed address

Hello,

I am new to PostFix. I would like to have PostFix (SMTP) forward/redirect "all" sent emails to another fixed desired address (such as admin@myserver.com) and most important field headers don't change (e.g. to cc bcc from subject...)

This is my example code:

1 /etc/postfix/main.cf:
2 virtual_alias_maps = hash:/etc/postfix/virtual
3
4 /etc/postfix/virtual:
5 * admin@myserver.com

I think the problem may be at Line 5 where I don't know which syntax can represent "all emails". I use *(star), but it seems not working. Thanks.
Reply With Quote
Sponsored Links
  #2  
Old 23rd April 2010, 22:46
philefluxx philefluxx is offline
Junior Member
 
Join Date: Oct 2009
Posts: 23
Thanks: 0
Thanked 1 Time in 1 Post
Default

Are you looking to monitor emails? If this is the case then there are some other options if you cannot find a way to get postfix to cc an address on every email. This is what I use to monitor mail traffic and statistics:

http://howtoforge.net/mail_statistic...h_pflogsumm_p2
Reply With Quote
  #3  
Old 26th April 2010, 01:59
RogueCoder RogueCoder is offline
Junior Member
 
Join Date: Apr 2010
Location: Nova Scotia, Canada
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That's not actually what he was asking, but never the less, it's good advice.

For your actual question, check this out: http://www.postfix.org/ADDRESS_REWRI....html#auto_bcc

It's exactly what you want from what I understand. The postfix documentation is a wonderful thing
__________________
"If at first you don't succeed; call it version 1.0"
Reply With Quote
  #4  
Old 26th April 2010, 04:00
kongi123 kongi123 is offline
Junior Member
 
Join Date: Apr 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Many thanks for you all above. It sounds good, however, what I need is that I don't want emails sent to the recipients directly, but sent to admin only (and then admin will consider and forward once approved). Auto_bcc will bcc to admin, but others in To: list will also see.

Sorry I didn't give a clear question
Reply With Quote
  #5  
Old 26th April 2010, 04:06
RogueCoder RogueCoder is offline
Junior Member
 
Join Date: Apr 2010
Location: Nova Scotia, Canada
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't have time to check this right now, but here's another suggestion

/etc/postfix/virtual
Code:
/^(.*)$/ admin@myserver.com
or

Code:
(.*) admin@myserver.com
If that doesn't work, check out this for reference

http://www.postfix.org/virtual.5.html
__________________
"If at first you don't succeed; call it version 1.0"
Reply With Quote
  #6  
Old 26th April 2010, 12:58
RogueCoder RogueCoder is offline
Junior Member
 
Join Date: Apr 2010
Location: Nova Scotia, Canada
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried to post a reply yesterday, but it didn't show up, not sure why.

I think you should try this code in your virtual file

Code:
(.*) admin_email@domain.tld
See, the file uses regular expressions, and * matches 0 or one of the previous characters, and . matches any character. So that is your wildcard, (.*)

Reference:

http://www.postfix.org/virtual.5.html
__________________
"If at first you don't succeed; call it version 1.0"

Last edited by RogueCoder; 26th April 2010 at 13:01.
Reply With Quote
  #7  
Old 27th April 2010, 16:59
kongi123 kongi123 is offline
Junior Member
 
Join Date: Apr 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Many thanks again, RogueCoder. It now almost works. Besides adding your code in virtual file, I have to define virtual_alias_domains in main.cf, right? The problem is that I don't know the value to be used in virtual_alias_domains for "any domain". This is my code:

/etc/postfix/main.cf:
virtual_alias_domains = (.*) <--- The problem is in this line, I think- It is not working
virtual_alias_maps = hash:/etc/postfix/virtual

/etc/postfix/virtual
(.*) admin@myserver.com

Otherwise, it should work. However, I just predict a further problem. If a sender uses "bcc:" and then the email is sent to admin, as configed. Can the admin see the email list in bcc field? How can the admin see it? Thanks.
Reply With Quote
  #8  
Old 27th April 2010, 20:07
philefluxx philefluxx is offline
Junior Member
 
Join Date: Oct 2009
Posts: 23
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by kongi123 View Post
Many thanks again, RogueCoder. It now almost works. Besides adding your code in virtual file, I have to define virtual_alias_domains in main.cf, right? The problem is that I don't know the value to be used in virtual_alias_domains for "any domain". This is my code:

/etc/postfix/main.cf:
virtual_alias_domains = (.*) <--- The problem is in this line, I think- It is not working
virtual_alias_maps = hash:/etc/postfix/virtual

/etc/postfix/virtual
(.*) admin@myserver.com

Otherwise, it should work. However, I just predict a further problem. If a sender uses "bcc:" and then the email is sent to admin, as configed. Can the admin see the email list in bcc field? How can the admin see it? Thanks.
I'm probably wrong, but you may be able to see bcc info in the header's of the email received by the admin. Ive always hated bcc, its shady imo.
Reply With Quote
  #9  
Old 28th April 2010, 14:08
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,740 Times in 2,575 Posts
 
Default

Quote:
Originally Posted by RogueCoder View Post
I tried to post a reply yesterday, but it didn't show up, not sure why.
Our forum spamfilter plugin thought that post was spam and put it into the moderation queue - I had to approve it. Sorry about that...
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Tags
forward, postfix, redirect

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
postfix, pop3 uvbnserved Server Operation 22 24th May 2009 21:00
Help needed error rpmbuild -ba postfix.spec mr_bo Installation/Configuration 2 15th May 2009 09:47
Undelivered Mail Returned to Sender Error202 General 5 7th May 2009 11:14
localhost postfix/master: fatal: bind 127.0.0.1 port 125: Permission denied g18c Installation/Configuration 4 24th March 2009 17:39
Virtual Users With Postfix, PostfixAdmin, Courier, Mailscanner,Mailwatch CentOS 5.2 tecstream HOWTO-Related Questions 3 16th July 2008 22:10


All times are GMT +2. The time now is 08:42.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.