PostFix: forward/redirect All emails to another fixed address

Discussion in 'Server Operation' started by kongi123, Apr 23, 2010.

  1. kongi123

    kongi123 New Member

    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.
     
  2. philefluxx

    philefluxx New Member

  3. RogueCoder

    RogueCoder New Member

  4. kongi123

    kongi123 New Member

    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 :)
     
  5. RogueCoder

    RogueCoder New Member

    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
     
  6. RogueCoder

    RogueCoder New Member

    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
     
    Last edited: Apr 26, 2010
  7. kongi123

    kongi123 New Member

    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.
     
  8. philefluxx

    philefluxx New Member

    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.
     
  9. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Our forum spamfilter plugin thought that post was spam and put it into the moderation queue - I had to approve it. Sorry about that... :eek:
     

Share This Page