Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 10-07-2012, 08:44 AM   #1
Registered: Mar 2007
Distribution: Slackware64-current, Slackware64 14
Posts: 327

Rep: Reputation: 49
msmtp from localhost and php mail


I'm trying to set up a website on my machine to test an authenticated register/log-in script. The script needs to send a mail to the registrant.

There are plenty of guides out there but not one I've been able to get working yet - once I've registered, the system fails to send a mail confirming the registrant's e-mail address.

This is what I've done

I have installed the msmtprc to /etc rather than ~ with permissions of 0644.

This is msmtprc;

# Accounts will inherit settings from this section
auth             on
tls              on
tls_trust_file   /usr/share/ca-certificates/mozilla/Thawte_Premium_Server_CA.crt

# gmail 
account        default
port           587
auth 	       on
password       password
A test mail from the command line works just fine.


I changed sendmail path to point to mstmp and mstmprc;

sendmail_path = '/usr/bin/msmtp -C /etc/msmtprc -t'
Then I restart httpd.

# /etc/rc.d/rc.httpd restart
Any help with helping me solve this problem would be much appreciated!
Old 10-07-2012, 04:24 PM   #2
Registered: Nov 2010
Posts: 227

Rep: Reputation: 61

Add this line to your .msmptrc defaults section
(0600 perms would be better):

logfile /path/to/msmtp.log

Open a terminal and run:

# tail -f /path/to/msmtp.log

Open another terminal and run

# tail -f /var/log/httpd/error_log

Do what you do with your php form paying attention
to the logs. PHP errors will appear at httpd error_log.

I've never used msmtp with php, I ignore where could be the problem.
1 members found this post helpful.
Old 10-07-2012, 05:11 PM   #3
Registered: Mar 2007
Distribution: Slackware64-current, Slackware64 14
Posts: 327

Original Poster
Rep: Reputation: 49
Thanks for the reply, much appreciated.

I'm 99% sure that it's a permissions issue on /etc/msmtprc.

Playing with various permissions I get either 'Permission denied' or 'must be owned by you' in httpd error.log.

I'll try the msmtp man and see what I can find.
Old 10-08-2012, 04:37 AM   #4
Registered: Nov 2010
Posts: 227

Rep: Reputation: 61
Try first this:

# chgrp apache /etc/msmtprc
# chmod 640 /etc/msmtprc
msmtp will ask you to use 600 on user config file.
I ignore if it's required on system config too.
If it still complains try:

# chown apache /etc/msmtprc
# chmod 600 /etc/msmtprc
But if the message appears on httpd error_log
it could be the permissions of the msmtp executable the cause.
On Slackware sendmail uses the gid bit and a smmsp group:

-r-xr-sr-x 1 root smmsp 800040 Apr 24  2010 /usr/sbin/sendmail
Perhaps you should do a trick alike with msmpt executable.

Anyway the above are just workarounds to find the problem.
More late you should investigate the "secure" solution.

Last edited by eloi; 10-08-2012 at 04:54 AM. Reason: typo


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Connection Refused error while sending mail using mutt and msmtp Iyyappan Linux - Server 2 06-30-2012 05:49 AM
php cannot invoke msmtp gmail_cs Linux - Newbie 6 03-10-2011 08:41 PM
msmtp/mutt trouble sending mail (server message: 451 4.4.1) Phieth6o Linux - Software 1 12-23-2009 03:23 PM
Msmtp on CentOS 5.2 : cannot send mail jonaskellens Linux - Newbie 2 07-10-2009 05:44 AM
Mail from root@localhost.localdomain thru relay=localhost.localdomain[] rshartog Linux - Server 2 02-02-2009 11:35 PM

All times are GMT -5. The time now is 05:35 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration