linux (fedora 20) msmtp configuration sends from shell but fails from PHP/apache, I am stumped... my objective is just to send email, through my gmail smtp from my localhost
FIXED - msmtp: cannot log to /var/log/msmtp: cannot open: Permission denied
This is for the next person who runs into this issue.
System config file for msmtp -rw-rw-rw- 1 root root 266 Jun 3 06:07 /etc/msmtprc
# mimecast
account mimecast
host smtp.mail.com
port 587
protocol smtp
from admin@company.com
auth on
user authuser@company.com
password mypassword
tls on
tls_certcheck off
logfile ~/.msmtp.log
syslog off
account default : mimecast
.#mimecast is just a section header and can be deleted
account mimecast - is a title if multiple send accounts are available or needed
account default : mimecast - is saying this is the default account used
The configuration file per user if needed can be the same as the system file with a different userid, password and from fields. note the "." before the .msmtprc
-rw------- 1 ubuntu ubuntu 267 Jun 3 05:50 .msmtprc
The log file gets created per user in their home directory with the correct permissions - no need to mess with the permissions.
-rw-r--r-- 1 root msmtp 344 Jun 3 06:09 .msmtp.log
To send an email from the command line
echo -e "Subject: MySubject\r\n\r\nThis is mybody" |msmtp recipient@company.com
use the -C configfilename to specify alternate local config files
use the -a account mimecast to switch between accounts to send from within the config file ( did not try this option )
or use
msmtp recipient@company.com
Subject: This is my subjectline
Blank line ( press enter )
Here is the body of the email
CTRL-D ( to send )
or use this option to send mail from the command line
msmtp recipient@company.com < filename
where the filename contains
To: recipient@company.com
From: sender@company.com
Subject: Here is the Subject
body body body .....