Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'd like to set up some sort of mail server to send emails from from my gmail account to another email. How can I do this?

share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

First, install sSMTP, since in this instance postfix is overkill. Yes, this will remove postfix. Do we care? Not really.

sudo apt-get install ssmtp
  1. Configure sSMTP by editing /etc/ssmtp/ssmtp.conf
#Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=yourusername@gmail.com
#I recommend setting this 

mailhub=smtp.gmail.com:587

# Where will the mail seem to come from?
rewriteDomain=

#The full hostname
hostname=[some hostname here]
UseTLS=YES
UseSTARTTLS=YES
AuthMethod=LOGIN
AuthUser=yourusername@gmail.com
AuthPass=yourpassword

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
# This is optional if you're going to use revaliases - I didn't
FromLineOverride=YES

Now, we need to set permissions on /etc/ssmtp/ssmtp.conf to help (it isn't foolproof) protect your plaintext password.

sudo chown root:nagios /etc/ssmtp/ssmtp.conf
sudo chmod 640 /etc/ssmtp/ssmtp.conf

Restart nagios and you should be set.

sudo service nagios3 restart
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.