Saturday, May 26, 2018

sendmail - php mail() not working if called from terminal

I'm trying to make a little newsletter. To send the E-Mails I would like to call the sender script with shell_exec().



$mail = new mail();

$mail->set('to', $to);
$mail->set('message', $content);
$mail->set('subject', 'Newsletter');
$mail->send();
?>


The mail() object is a simple class to send E-Mails and calls the php mail() function in the ->send() method. The header gets added before sending.



If i call this script in my browser on pageload, it works as it should. But on:




php send_mail.php


Nothing happens. The mail() function returns true and all parameters are correctly set if I'm outputting these before sending.



Also I checked /var/log/mail* but there is no error produced.



I tried calling the script by relativ and absolute path. Both don't work.




I'm stuck now because the mail() function only doesn't work if called from terminal, otherwise erverything seems fine.



I am using sendmail to send E-Mails.



How can I fix this?



Thank you :)

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...