You can use your Gmail account as a smart host to send all messages from your Linux computer.
You need to use a simple program called ssmtp. It accepts a mail stream on standard input with recipients specified on the command line and synchronously forwards the message to gmail.
This is great as all your messages look like they come from gmail and are saved in your sent items for reviewing later on.
Lets do the install.
Installing ssmtp
Type the following command under Debian / Ubuntu Linux: you could use yum under fedora.
# apt-get update && apt-get install ssmtp
Configure gmail as a smarthost
Open /etc/ssmtp/ssmtp.conf, enter:
# vi /etc/ssmtp/ssmtp.conf
Update file with the following to the end:
AuthUser=yourname@gmail.com
AuthPass=Your-Gmail-Password
FromLineOverride=YES
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
Removing any old mail agents
Disable any other mail agents you have installed sendmail or postfix are most common, if you are using them:
To find out if they are installed type:
# dpkg -l |grep mail
# dpkg -l |grep post
If none are found skip this section and test your send mail.
Now stop the mail deamon if one was found:
# service sendmail stop
# service postfix stop
I like to use chkconfig or sysvconfig under debian so you may need to use apt-get install for these packages:
chkconfig is from my fedora and redhat days it is a cmd line program
sysvconfig is similar to ntsysv under redhat fedora again but it is in a tui or text user interface.
NOTE: If you must use a gui then install BootUpManager aka "apt -get install bum"
# apt-get update && apt-get install checkconfig
# chkconfig sendmail off
This removes the link to sendmail (note you won't need to do this if it was not installed previously)
# rm /usr/sbin/sendmail
In debian type
# ln -s /usr/sbin/ssmtp /usr/sbin/sendmail
For other linux you may need to use:
# ln -s /usr/local/ssmtp/sbin/ssmtp /usr/sbin/sendmail
Send a TEST Mail
Now, you can use mail / mailx command to send email messages. You can also write a shell script to backup your files and email to somewhere else (see below). You can test settings using following syntax:
# echo "This is a test" | mail -s "Test" me@gmail.com
NOTE: If the mail command is not found then install mailx as follows, and substitute mail for mailx in the test:
# apt-get install mailx
Told you it was quick and easy
# cp /boot/grub/menu.lst /boot/grub/menu/lst.20090729