martedì 13 agosto 2013

Configure msmtp to work with gmail on linux

Test environment
  • Mac OS X 10.6, Mutt 1.4.2.3i
  • Ubuntu 12.04 LTS, Mutt 1.5.21
Install it on Ubuntu
sudo apt-get install mutt -y

Send mail

Mail service provider settings

QQMail

Settings -> Accounts -> POP3/IMAP/SMTP/Exchange Service -> Options 
 
check 'POP3/SMTP Service'
 
Install SMTP client [msmtp] [http://msmtp.sourceforge.net]

sudo apt-get install msmtp msmtp-mta -y
sudo apt-get install msmtp ca-certificates 
 
create or update ~/.muttrc

set editor="emacs -nw "
set sendmail="/usr/sbin/sendmail"
set sendmail_wait=10
 
create or update ~/.msmtprc

defaults
tls on
tls_starttls on
tls_certcheck on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile /tmp/msmtp.log
account default              
host smtp.gmail.com
port 587                     
from my_account@gmail.com
auth on                     
user my_account
password secret
 
 
change configuration file's permission

chmod 600 ~/.msmtprc
 
send mail

echo 'content' | mutt -s 'subject' -- to_some_one@test.com
 
send mail with attachment

echo 'content' | mutt -s 'subject' -a /tmp/attach.zip -- to_some_one@test.com

5 commenti:

  1. A very good and interesting post that i have come across, thanks for sharing the post.
    Really appreciable.

    RispondiElimina
  2. The posted letters is very informative. It is a delight reading it. I have also bookmarked you for ascertaining out new mails.
    by MKT 421 Entire Course | MGT 311 Entire Course Provider

    RispondiElimina
  3. thanks for sharing the useful links,good coding and very easy to refer
    business meeting locations in coimbatore

    RispondiElimina