I have a script like that :
<html>
<body>
<?php
$addresses = ['foo@mydomain.com'];
foreach ($addresses as $address) {
sendMail($address);?><br /><?php
}
?>
<?php
function sendMail($address) {
mail($address, "object", "message");
print $address;
}
?>
</body>
</html>
I installed and configured the mail server haraka. I think that my configuration is ok : When I use the command swaks -tls -f test@mydomain.com -t foo@mydomain.com -s localhost -p 587 -au testuser -ap testpassword
, i receive correctly the mail.
But when I send a mail via the mail function in PHP, I don't receive anything.
In my php.ini
, I configure :
;[mail function]
SMTP = localhost
smtp_port = 587
username = testuser
password = testpassword
sendmail_from = test@mydomain.com
After script's execution, when I check haraka's logs, I don't see anything. But in the file /var/log/maillog
, I can see that sendmail's logs are adds.
Can you tell me how o configure PHP to use correctly my local mail server Haraka ?