For: CentOs 6.9 x86_x64, XAMPP, Postfix, mail relay server

Ever got into the situation where you install XAMPP on a Linux server and realize that the mails you send through your PHP application don’t get delivered ?

  • Check /var/log/mailog for any errors.
  • Verify using telnet if the SMTP connection works.
  • Try the following command and check if the mail is delivered.
    echo "My message" | mail -s subject user@gmail.com
  • Check /etc/postfix/main.cf:/etc/postfix/main.cf:
    relayhost = mail-relay-IP

    Flush postfix mail queue:

    postfix -f
  • Check if SELinux is allowing SMTP connections
    [root@webserver ~]# sestatus -b | grep sendmail
    httpd_can_sendmail                   off

    If httpd_can_sendmail is set to ‘off’ like above then do the following

    setsebool httpd_can_sendmail=1
    service postfix restart

    Then restart Apache.

References:
http://www.phpin24.co.za/apache/sendmail-setup-on-linux-with-apache-php/
https://mediatemple.net/community/products/dv/204404584/sending-or-viewing-emails-using-telnet

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s