문제

example.com has a web server and a mail server.

Email sent from the web server to any email address (except @example.com) works.

Email sent to @example.com works from any other source.

Web server is setup to use webmail. The web server is Ubuntu 12.04 with Apache and PHP

Any help appreciated. Thanks.

=== edit

This fixed the problem, thanks

https://serverfault.com/questions/65365/disable-local-delivery-in-sendmail/128450#128450

도움이 되었습니까?

해결책

Apache was trying to handle the email locally on our server. When I looked at the log response I saw it was returning the following error.

User unknown
550 5.1.1 recepient@example.com

After following these steps the email was routed to the correct mail server. My setup is Ubuntu 12.04 with PHP 5 Apache2 and Sendmail.

  1. Edit the sendmail config file on the Apache server:

    sudo nano /etc/mail/sendmail.mc
    
  2. At the end of the file add the following lines of code to handle email correctly:

    define(`MAIL_HUB', `example.com.')dnl define(`LOCAL_RELAY',
    `example.com.')dnl
    
  3. Save the file and exit.

  4. Update the sendmail setup in the command prompt:

    sudo sendmailconfig
    

    Follow the steps, I said yes to everything

  5. Restart sendmail:

    sudo service sendmail restart
    
  6. Try sending the email again. It should work now.

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