Archive for the ‘gmail’ tag
Setting up Gmail to work from Command line on Ubuntu
After some looking around, particularly this post on Ubuntu email with Mailx (which is incomplete, if you follow all the instructions, you will realise that the certificate he is talking about does not exist in the tgz that you download) and a few others, I got my mailx to work with my gmail account.
I guess you can try setting up an MTA such as exim and use sendmail or even mail, but that seemed quite complicated and I wanted to send out a mail from my shell script as quickly as possible.
Here are the steps involved which I wrote up as a little shell script:
Update: The Script got messed up when I ported the blog from Blogspot to wordpress.
#! /bin/sh sudo apt-get install ca-certificatessudo update-ca-certificates sudo apt-get install msmtp mailx echo "# config options: http://msmtp.sourceforge.net/doc/msmtp.html #A-user-configuration-file defaults logfile /tmp/msmtp.log # gmail account account gmail auth on host smtp.gmail.com port 587 user EMAIL password PASSWORD from EMAIL tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt # set default account to use (not necessary with single account) account default : gmail" > ~/.msmtprc chmod 600 ~/.msmtprc echo "# set smtp for nail set from=\"EMAIL (YOUR NAME)\" set sendmail=\"/usr/bin/msmtp\" set message-sendmail-extra-arguments=\"-a gmail\"" > ~/.mailrc echo "Edit CAPTIALS in .msmtprc and .mailrc and run a test message like this: "echo "echo Message | mailx -s \"this is subject\" user@email.com\n"
Enjoy!
