MSMTP Configuration - Can't send through php mail()

I have msmtp set up and works. When I issue the command msmtp –serverinfo and also issue a command to send an email through the command line in msmtp there are no problems.

When I try to use php's mail() function, it doesn't work. I updated the php.ini file and sendmail_path to the msmtp location and it resorts back to the /usr/sbin/sendmail which is confusing. I restarted both apache and rebooted the server to no avail.

As I see it, there's a loose configuration option for php.ini's sendmail_path somewhere that still points to /usr/sbin/sendmail instead of /usr/bin/msmtp.

Does anyone have any thoughts or is there anything I can post that would help?

Travis

5 Replies

If you're running modphp check your apache configuration for a phpvalue option also run php –info | head -15 and check for these settings

Loaded Configuration File =>

additional .ini files parsed =>

They tell you what ini files you've loaded.

@obs

Thanks for the recommendation. I found out that another php file was the primary one - /etc/php5/cli/php.ini (instead of /etc/php5/apache2/php.ini).

This fixed my command line problem of being able to send mail. But creating a php script that sends an email still fails. Is there a php config setting that disables scripts from using the mail() function?

Some googling didn't result in any satisfactory answers/leads. The debug simply says your server might not be configured to send mail using this method.

Thanks!

Travis

only disable_functions would stop you sending mail, check your msmtp logs and see if php is actually talking to msmtp

@obs

Thanks for the response. According to both logs there is no record of me having requested to send a message through a php script.

Here's what I have in mail.log:

mail() on [Command line code:1]: To: kiefertravis@gmail.com – Headers:

Here's what I have in msmtp.log:

Dec 01 23:55:07 host=smtp.gmail.com tls=on auth=on user=cto@gumballcapital.org from=cto@gumballcapital.org recipients=kiefertravis@gmail.com mailsize=94 smtpstatus=250 smtpmsg='250 2.0.0 OK 1291247707 i21sm335658yha.44' exitcode=EX_OK

Both of these are from calling the php mail function from the command line. There is some kind of disconnect for the script and I don't know what it is or where to look for it.

Thoughts?

Travis

Did you get a solution to this?

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct