Hello,
There can be two posible situations:
- Your server does not send emails through scripts;
- yahoo, gmail, etc. reject emails from your serevr.
What should be checked in first situation:
1) You can use following simple php script which works 100%, for example with this code:
<?php
$to = "
[email protected]";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
If you received the message "Message successfully sent!", it means that the problem is in syntax of you script;
3) If you received the message "Message delivery failed", what records appear in /var/www/vhosts/$domain_name/statistics/logs/error_log when you try sending mail with php script.
Here $domain_name is the name of the domain on which this script is executed.
4) Check what records appear in /var/log/messages upon script execution. If you see records like:
deny httpd_sys_script_t var_t:file { execute getattr };
deny httpd_t self:tcp_socket connect;
deny httpd_t usr_t:dir write;
deny httpd_t var_log_t:file { append getattr setattr };
deny httpd_sys_script_t devlog_t:sock_file write;
deny httpd_sys_script_t self:unix_dgram_socket {connect create write };
Then this must be caused by Selinux. Check selinux status with getenforce command and if Selinux is in enforcing mode try switching it to permissive mode using following command:
# setenforce 0
In second situation:
Send a message to an email account on yahoo, gmail, etc. and then check /usr/local/psa/var/maillog and maillog files on destination server (yahoo, gmail) to get exact reason why the message was rejected.