Reputation: 4245
I have a load balancer that also works as a mail server.
I want the clusters to use the load balancers mail server as their default mail system for the PHP mail()
function
The settings on the php.ini
file look like this:
[mail function]
SMTP = mail.email.info
smtp_port = 25
sendmail_from = [email protected]
sendmail_path = /usr/sbin/sendmail -t -i
I have added this to the main.cf
:
myhostname = mail.email.info
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.1.71 192.168.0.*
as the clusters are on the 192.168.0.*
subnet.
The mail server on the LB is working perfectly. I am using it for lots of virtual hosts and it is set up on lots of mail software (for example sparrow) So this is not likely to be an issue with it, but more likely to be to do with the permissions of it.
When running the PHP script on the cluster:
<?php
mail("[email protected]","subject","msg");
?>
Nothing is happening. Why?!
Please do not be afraid to ask for more info.
Upvotes: 2
Views: 98
Reputation: 13107
According to the PHP documentation, the smtp_port
and other options are only used on Windows. Generally, PHP's mail()
is not really made for using a remote MTA.
I would recommend using a third party library such as SwiftMailer. Not only can you dispatch your mail to a remote MTA, but you get some valuable extras, too:
and many more.
Upvotes: 1