Bug #78916 [Com]: php-fpm 7.4.0 don't send mail via mail()

From: Date: Fri, 06 Dec 2019 07:27:19 +0000
Subject: Bug #78916 [Com]: php-fpm 7.4.0 don't send mail via mail()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224087@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78916&edit=1

 ID:                 78916
 Comment by:         retertertert at fgfgfg dot com
 Reported by:        ilya at ilya dot pp dot ua
 Summary:            php-fpm 7.4.0 don't send mail via mail()
 Status:             Open
 Type:               Bug
 Package:            *Configuration Issues
 Operating System:   systemd/linux
 PHP Version:        7.4.0
 Block user comment: N
 Private report:     N

 New Comment:

or just don't use mail() - where i work that's a forbidden and disabled function for 20
years now for security reasons and before i remove "NoNewPrivileges=true" for the sake of
calling sendmail i commit suicide

https://github.com/PHPMailer/PHPMailer


Previous Comments:
------------------------------------------------------------------------
[2019-12-06 07:18:34] ilya at ilya dot pp dot ua

-NoNewPrivileges=true

-RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
+RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK

Solves my problem.

------------------------------------------------------------------------
[2019-12-05 18:37:03] ilya at ilya dot pp dot ua

After
-RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
+RestrictAddressFamilies=AF_INET AF_INET6 AF_LOCAL AF_UNIX AF_NETLINK

Error in postfix log:
fatal: mail_queue_enter: create file maildrop/508120.1166: no permission
warning: command "/usr/sbin/postdrop -r" exited with status 1
fatal: info@gricargo.com(467): unable to execute /usr/sbin/postdrop -r: Success

nginx log is empty.

What else needs to be changed in this systemd file?

------------------------------------------------------------------------
[2019-12-05 16:12:28] ilya at ilya dot pp dot ua

> Since the error is logged by postfix I don't think this is caused by php-fpm, who provides
> /usr/bin/sendmail on this machine?

php-fpm 3.7.11 work fine

#!/usr/bin/env sh
echo -e 'Subject:'date +'%H:%M %d.%m.%Y''\nTest from Ilya to
Google' | /usr/sbin/sendmail my_gmail_name@gmail.com

Work fine!

LC_ALL=en sudo cnf sendmail

Program 'sendmail' is present in package 'postfix', which is installed on your
system.

Absolute path to 'sendmail' is '/usr/sbin/sendmail', so running it may require
superuser privileges (eg. root).

postfix 3.4.8

------------------------------------------------------------------------
[2019-12-05 16:05:18] ilya at ilya dot pp dot ua

<?php
$to_mail = 'user@user.server.com';
$from_mail = 'you@your.server.com';
$from = 'You <'.$from_mail.'>';
$headers =
[
	'MIME-Version' => '1.0',
	'Content-Type' => 'text/html; charset=UTF-8',
	'Content-Transfer-Encoding' => 'binary',
	'From' => $from,
	'Reply-To' => $from,
];
mail($to_mail, 'Test message', <p>Test message.</p>, $headers,
'-f'.$from_mail);
?>

------------------------------------------------------------------------
[2019-12-05 16:05:13] ilya at ilya dot pp dot ua

<?php
$to_mail = 'user@user.server.com';
$from_mail = 'you@your.server.com';
$from = 'You <'.$from_mail.'>';
$headers =
[
	'MIME-Version' => '1.0',
	'Content-Type' => 'text/html; charset=UTF-8',
	'Content-Transfer-Encoding' => 'binary',
	'From' => $from,
	'Reply-To' => $from,
];
mail($to_mail, 'Test message', <p>Test message.</p>, $headers,
'-f'.$from_mail);
?>

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=78916


--
Edit this bug report at https://bugs.php.net/bug.php?id=78916&edit=1


Thread (14 messages)

« previous php.bugs (#224087) next »