A
A
AUN2015-12-26 19:23:24
PHP
AUN, 2015-12-26 19:23:24

php mail is not working. Why?

Hey!
Project in Yii2. Sending mail using the mail function does not work. Os debian 8. Php 5.6
Sending mail from console: echo 123 | exim4 [email protected]
exim 4 started : ps -e | grep exim4
phpinfo:

mail.add_x_header	On	On
mail.force_extra_parameters	no value	no value
mail.log	/var/log/mail.log	/var/log/mail.log
....
sendmail_from	no value	no value
sendmail_path	/usr/sbin/exim4 -t	/usr/sbin/exim4 -t

/var/log/mail.log no errors
I send it like this:
$to      = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" ';
var_dump(mail($to, $subject, $message, $headers)); //false

The mail.log indicates that everything is being sent.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AUN, 2015-12-27
@AUN

I looked at what is in /var/log/exim4/paniclog
. There was also the following:

Unable to set gid=33 or uid(euid=0): forcing real=effective
...

Decided this way:
Nano /etc/apache2/mods-available/mpm_prefork.conf
<IfModule mpm_prefork_module>
…
LimitUIDRange 0 2000
</IfModule>

After that, letters began to arrive immediately.

O
Oleg Matrozov, 2015-12-26
@Mear

Try giving the fifth parameter to mail like "[email protected]". Exim probably lacks the sender address and the From field in the headers is not enough for it. Examples are in the help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question