You are not logged in.

#1 2012-10-18 11:02:22

ackt1c
Banned
From: Visalia, California
Registered: 2012-10-10
Posts: 241

[solved] msmtp only works at prompt, by nginx fastcgi php-fpm.

[ackt1c@arch http]$ sudo php mail.php
works -------------------^
nginx returns 200 OK but 127.0.01/mail.php fails using

<?php
mail("yes@myemailhere.com", "Test email from PHP", "msmtp as sendmail for PHP");
?>

I have set sendmail in php.ini and that works in terminal.
But not remotely...
/etc/php/php-fpm.conf reads

; Default Value: nothing is defined by default except the values in php.ini and
;                specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com

I have tryed commented, uncommented, quoted, and unquoted as archwiki shows https://wiki.archlinux.org/index.php/Ms … sing_msmtp

php_admin_value[sendmail_path] = "/usr/bin/msmtp -C /etc/msmtprc -t"

my /etc/nginx.ini fastcgi location reads

	location ~ \.php$ {
		fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
		fastcgi_index  index.php;
		root           /srv/http;
		include        fastcgi.conf;
	}

Tryed Ports 587 and 25.

I have tryed switching the ca-certificate to Equifax, set /etc/msmtprc group to http 600 655 700 755 777; installing heirloom-mailx and msmtp-mta, setting /etc/mail.rc to 'set sendmail=/usr/bin/msmtp'
Syslog on is not generating an output; and I'm all together stumped...the same thing happened with smtp a couple months ago. I'm down to /etc/msmtprc permission "since terminal works" or nginx fastcgi location/php-fpm.ini.
Thanks.

/var/log/nginx/error.log

2012/10/18 06:39:50 [error] 8097#0: *11 FastCGI sent in stderr: "PHP message: PHP Warning:  mail(/var/log/msmtp): failed to open stream: Permission denied in /srv/http/mail.php on line 2" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /mail.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.sock:", host: "127.0.0.1"

set rw on /var/log/msmtp getting

mail() on [/srv/http/mail.php:2]: To: my@emailhere.com -- Headers: 

still stumped on this one.

EDIT

sudo chmod 600 /etc/msmtprc
sudo chown http:http /etc/msmtprc

works!

Last edited by ackt1c (2012-10-18 17:44:16)

Offline

#2 2013-09-19 14:42:59

sprinf
Member
From: Douala, Cameroon
Registered: 2013-03-20
Posts: 40
Website

Re: [solved] msmtp only works at prompt, by nginx fastcgi php-fpm.

Thank you  Very much this worked for me too

Offline

Board footer

Powered by FluxBB