문제

In order to not accidentally send real emails to people outside the company from an integration test server, I'd like to configure postfix to only send emails to addresses like *@somecompany.com and drop all other emails. Is it possible to somehow configure it in /etc/postfix/main.cf and if yes then how?

도움이 되었습니까?

해결책

You can specify like that with the help of /etc/postfix/transport file You can add the line transport_maps = hash:/etc/postfix/transport in main.cf Do the steps below Create a transport - transport1 and Mail sent to user "user@gmail.com" should go through transport1 and all other mail sent should go through default.

First stop dual instances of postfix if any. Open /etc/postfix/main.cf and set inet to all.

  • Add the following to master.cf

    transport1      unix    -       -       n       -       1       smtp
       -o smtp_bind_address= (add a space at 1st)
       -o syslog_name=postfix-localroute1 (add a space at 1st)
    
  • Add/create the following to /etc/postfix/transport

    somecompany.com    transport1:
  • Run postmap after defining the transport file.

    postmap /etc/postfix/transport

I have defined a transport above. It means all mail to @somecompany.com will go through you specifed in transport and that ip will not b displayed as it is in maillog. Instead it will be shown as postfix-localroute1

  • Add the following to main.cf

    transport_maps = hash:/etc/postfix/transport
  • Run:

    postmap /etc/postfix/transport

  • Reload postfix:

    postfix reload

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top