http://www.absolutelytech.com/2010/07/17/howto-configure-msmtp-to-work-with-gmail-on-linux/
----
http://msmtp.sourceforge.net/doc/msmtprc.txt
http://msmtp.sourceforge.net/documentation.html
---
Msmtp is a small but powerful and highly customizable smtp client. You can access gmail smtp using msmtp, which is exactly what I’ll teach in this tutorial.
Step by step instructions:
- Install msmtp and ca-certificates for use with SSL:
sudo apt-get install msmtp ca-certificates
- We’ll create and edit the configuration file using Gedit:
sudo gedit /etc/msmtprc
Now copy and paste the following code in the text editor:
defaults tls on tls_starttls on tls_trust_file /etc/ssl/certs/ca-certificates.crt account default host smtp.gmail.com port 587 auth on user username@gmail.com password mypass from username@gmail.com logfile /var/log/msmtp.log
Needless to say, you have to replace [email protected] with your email and mypass with your password
- It should be readable by anyone. However, we’ll still execute the following command to be sure.
sudo chmod 0644 /etc/msmtprc
- Your msmtp configuration is ready. Lets send a test email to yourself to see if everything’s working properly:
echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" |msmtp --debug --from=default -t username@gmail.com
Again replace [email protected] with your own email address and execute it. You should receive an email.
These are the exact commands to be used with Ubuntu.
You can replicate the steps for another distibution by using equivalent commands (For eg; yum install in place of apt-get install for centos, redhat, fedora.)
Cheers!
Related posts:
- [HOWTO] Send emails(using mail function) from localhost in PHP through msmtp (using gmail account) on Linux
- [HowTo] Use mutt with msmtp
- [HowTo] Forward all gmail mails to new address when you’ve run out of space
- [HOWTO] Delete all unstarred emails from Inbox or Label in GMail
- [HOWTO] Use local phpmyadmin with remote MySQL
CATEGORY: How-To, Ubuntu (Linux)
TAGGED: ca-certificates, Gmail, linux, msmtp, msmtp gmail, ubuntu