LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 10-07-2012, 07:44 AM   #1
Bazzaah
Member
 
Registered: Mar 2007
Distribution: Slackware64-current, Slackware64 14
Posts: 324

Rep: Reputation: 49
msmtp from localhost and php mail


HI

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;

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

# gmail 
account        default
host           smtp.gmail.com
port           587
auth 	       on
from           address@gmail.com
user           address@gmail.com
password       password
A test mail from the command line works just fine.

/etc/httpd/php.ini

I changed sendmail path to point to mstmp and mstmprc;

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

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

Rep: Reputation: 50
Logs?

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

Code:
logfile /path/to/msmtp.log

Open a terminal and run:

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

Open another terminal and run

Code:
# 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, 04:11 PM   #3
Bazzaah
Member
 
Registered: Mar 2007
Distribution: Slackware64-current, Slackware64 14
Posts: 324

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, 03:37 AM   #4
eloi
Member
 
Registered: Nov 2010
Posts: 198

Rep: Reputation: 50
Try first this:

Code:
# 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:

Code:
# 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:

Code:
-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 03:54 AM. Reason: typo
 
  


Reply


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 04:49 AM
php cannot invoke msmtp gmail_cs Linux - Newbie 6 03-10-2011 07:41 PM
msmtp/mutt trouble sending mail (server message: 451 4.4.1) Phieth6o Linux - Software 1 12-23-2009 02:23 PM
Msmtp on CentOS 5.2 : cannot send mail jonaskellens Linux - Newbie 2 07-10-2009 04:44 AM
Mail from root@localhost.localdomain thru relay=localhost.localdomain[216.24.138.1] rshartog Linux - Server 2 02-02-2009 10:35 PM


All times are GMT -5. The time now is 05:13 PM.

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