25 comment

  1. You could also leave the original address to keep a copy locally before forwarding, or have multiple email addresses seperated by commas.

    [email protected] [email protected], [email protected]

  2. If I do [email protected] [email protected], [email protected], the [email protected] gets two copies of mail for every mail sent to [email protected]

  3. How i can get this functionality ?
    —————————————————-
    Directory: /home/logmon Shell: /bin/bash
    Never logged in.
    Mail forwarded to “|/usr/local/bin/logmon.sh”
    No mail.
    No Plan.
    —————————————————-

    Plz help

  4. Hi,

    I have added the lines as per said and is working fine. Now i want remove the forwarding, so i removed the added lines and restarted the postfix. But still the script is running. can u tell a solution to fix it?

  5. Hi,

    how can u configure postfix to send EVERY E-Mail to exactly ONE User on your machine?

    for example:

    I create a user “mailarchiv”.

    Every mail which goes to the Server “mail-05” should be saved in the Mailbox of “mailarchiv”.

    Can u give me a hint?

  6. Here’s a little extra info that might help someone. I was going nuts looking for a way to forward any number of aliases to a single user based on regex. It’s similar to what this faq suggests and very easy, and it can be used for local and remote fowarding. Here’s the whole thing:

    1) Add a user (this will be your catch-all): useradd tiger

    2) Open your postfix config: vi /etc/postfix/main.cf

    3) Add the following to the bottom of the file:
    virtual_alias_domains=/etc/postfix/virtual_config/virtual_alias_domains
    virtual_alias_maps=regexp:/etc/postfix/virtual_config/virtual_alias_maps

    4) Create the virtual_config path: mkdir /etc/postfix/virtual_config

    5) Open the alias domains file: vi /etc/postfix/virtual_config/virtual_alias_domains

    6) Add all domains for which you wish to allow relays/forwarding to virtual_alias_domains file. Add one domain per line. For example, /etc/postfix/virtual_config/virtual_alias_domains:
    example.com
    anything.com

    7) Open your alias maps file: vi /etc/postfix/virtual_config/virtual_alias_maps

    8) Add in your regex aliasing:
    /^troy@/
    tiger
    [email protected]

    9) Restart postfix (note: reload doesn’t always do what you want. Just restart): service postfix restart

    After that, all mail sent to your server and addressed to [email protected] or [email protected] will be forwarded to the user tiger on the local machine AND to [email protected]

    I hope that saves someone some looking.

  7. I did this, precisely as described, and now all mail to my server is rejected.

    cat /etc/postfix/virtual
    [email protected] [email protected]
    [email protected] [email protected]
    [email protected] [email protected]

    can’t get mail to any of the .org, .me, or .us, and can’t even get mail to the .info address.
    All of these addresses were working before I did this.
    Clearly, I want to send them all to one address, the .info address,
    but now nothing gets through at all.
    This is on Debian Squeeze, if relevant.

    1. Also, blanking the virtual file and restarting postfix doesn’t put it back to working properly, either.
      Following your instructions has hosed my mail server completely.
      The e-mail addresses mentioned above are all in the mail db (mysql).
      You do not mention whether this is relevant or not.
      I was using them all as distinct mail address, and they were working, and I want to forward them all to one, now.
      But if I can’t do that, at the very least, I’d like them to work as they before.
      Currently none of them are working.

      1. well, I seem to have got it working as it was again.
        I had to empty the /etc/postfix/virtual,
        remove the virtual_alias_domains line in my main.cnf
        I ran sudo newaliases
        and reloaded postfix
        and it’s back to the previous “normal” state.
        Clearly I’ll have to seek how to forward my mail properly elsewhere.

  8. There is really useful comments here and the post was amazing, thanks!
    If you followed the post, but still are not receiving e-mails, there is 2 things to check:

    Try running “postconf -n” in the terminal and check for both options that you set in main.cf (virtual_alias_domains and virtual_alias_maps)

    I checked that and it was still ok. But redirecting was not working.

    So, reading the postfix log (/var/log/mail.info) i see a warning:
    do not set mydestination and virtual_alias_domains the same. So, I edited mydestination and removed the domain and now it works.

    Before:
    mydestination = smtp.transjosp.com.br, transjosp.com.br

    After:
    mydestination = smtp.transjosp.com.br

  9. Warning! I have encountered that with a default postfix configuration this will open your server for SPAM as it allows log in via unauthenticated locations. Dear author, please add a line on smtp restrictions!

    I have disabled SASL as it seems to be unneeded for forwarding only and disable the unauthenticated destinations for now as a first step.

    default main.cf:
    smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination

    mail.log:
    Mar 29 19:23:10 planetsofa postfix/smtpd[11118]: warning: hostname 88.249.45.76.dynamic.ttnet.com.tr does not resolve to address 88.249.45.76: Name or service not known
    Mar 29 19:23:10 planetsofa postfix/smtpd[11118]: connect from unknown[88.249.45.76]
    Mar 29 19:23:10 planetsofa postfix/smtpd[11118]: 5F14113E0005: client=unknown[88.249.45.76]
    Mar 29 19:23:10 planetsofa postfix/cleanup[11122]: 5F14113E0005: message-id=

  10. i have configured mail server on two machine , machine-1 installed squirrelmail GUI and machine-2 is my server( postfix ,dovecot..etc) ,machine-1 is on public ip but machine-2 is on private ip because machine-2 have all user and mailbox to recive mail for security purpose, i am able to send mail but not receive mail, but if i am using only one machine then I’m successfully send and Receive mail , but my task is to setup mail server on 2 machine, so where is problem please reply me soon?

  11. I have followed the instructions above. And everything seems to work well. but I am using gmail.com to receive the forwarded emails. For now, when I sent an email from [email protected] to [email protected], this mail is sent from gmail but I can’t receive this email from [email protected] which is aliased to [email protected]

    I have checked the mailname as stated in one of the comments and it is good.

    Please any help on this ??

    thanks

Leave a Comment