Article 4THKR php mail with msmtp and apache isnt working correctly

php mail with msmtp and apache isnt working correctly

by
gwabber
from LinuxQuestions.org on (#4THKR)
Hi all,

At first excuse me for my English, i am Dutch.

I have a problem configurating msmtp with php and apach2 in Debian 10.

When I try to mail with php trough the commandshell, it works. Also if I execute a php page trough the php command with shell, it works. But when I open the page in a browser with apache2 webserver, the mail won't sent. Can anyone help me with this problem?

My sendmail config:

Code:# Set defaults.
defaults
# Enable or disable TLS/SSL encryption.
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
# Setup WP account's settings.
account XXXXXXXX
host smtp.gmail.com
port 587
auth login
user XXXXXXX
password XXXXXXXX
from XXXXXXXXX
logfile /var/log/msmtp/msmtp.log
account default :XXXXXXXXXXMy sendmail config in /var/php/7.3/apache2/php.ini:

Code:sendmail_path = "/usr/bin/msmtp -C /etc/msmtprc -t"my demo_mail.php :
Code:<?php
mail("mail@mail.com","Hello World","Email sent using PHP via msmtp");
?>
Thanks in advance.

Gwabber.latest?d=yIl2AUoC8zA latest?i=DacFZzX1Dy0:6_3KsFCEjr8:F7zBnMy latest?i=DacFZzX1Dy0:6_3KsFCEjr8:V_sGLiP latest?d=qj6IDK7rITs latest?i=DacFZzX1Dy0:6_3KsFCEjr8:gIN9vFwDacFZzX1Dy0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments