I figure this is simple stuff for most forum members, but as a newbie this as taken me hours to research and solve.
I spent some time trying to get msmtp working with a gmail account, so thought I'd share what I've found and what now works for me.
NB I have a minimal Core system with no GUI, and so I do not have firefox installed as per the directions in the above link.
With msmtp and mailx extensions installed,
Created .msmtprc file in home directory and edited as follows:
account default
host smtp.gmail.com
port 587
protocol smtp
auth on
from myaddress@gmail.com
user myaddress
password mypassword
tls on
tls_starttls on
tls_trust_file /home/tc/Equifax_Secure_Certificate_Authority.cer
I ran chmod 0600 on this file after creating it 'cos I read somewhere that I should. Not sure how secure this all is as the file contains my password in clear text?
My main problem was finding a valid tls_trust_file, so I eventually found and downloaded one:
wget http://www.geotrust.com/resources/root_certificates/certificates/Equifax_Secure_Certificate_Authority.cer
I don't understand this certificate stuff but it works - please chime in if I am opening my system up to spammers...
I then created a .mailrc file in my home directory, and edited as follows:
account gmail {
set smtp-use-starttls
set smtp=smtp://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=myaddress@gmail.com
set smtp-auth-password=mypassword
set from="myaddress@gmail.com"
}
Did a chmod 0600 on that file too for what it's worth...
I can now send emails via my gmail account:
to just send a message from a script:
tc@box:~$ echo "This is the message body" | mailx -A gmail -s "This is the message Subject" sendtoaddress@isp.com.au
or to send a log file in the message body
tc@box:~$ cat somelogfile | mailx -A gmail -s "somelogfile in body :-)" sendtoaddress@isp.com.au
Can someone confirm if this setup is ok or otherwise, specifically with regards to security? I am the only user of this system, which has passwords setup but still uses autologin, and has remote access via SSH.
Cheers
Tim