Send emails from Ubuntu using your live.com address

This is a neat configuration to enable SMTP mail using Microsoft’s Live.com email. After successful configuration you’ll be able to send outgoing mails from your Ubuntu box using your live.com account. (Other email services will work too. I haven’t tested though).

Will you ever manually send emails from Ubuntu? Perhaps not but this configuration is extremely useful in sending out system notifications to your email address. It’s also useful to send messages from websites hosted on the box. For example, the contact form on my blog works this way.

Alright, here’s how to do it.

We will be configuring SSMTP on Ubuntu.

You need: a live.com email address, and Ubuntu machine with sudo access

Step 1 – Install ssmtp

sudo apt-get install ssmtp

Step 2 – Open config file

sudo vi /etc/ssmtp/ssmtp.conf

Step 3 – Enter details and Save

[email protected]

mailhub=smtp.live.com:25

[email protected]

AuthPass=yourpassword

useTLS=YES

useSTARTTLS=YES

rewriteDomain=live.com

hostname=live.com

FromLineOverride=YES

Step 4 – Add Reverse Aliases

sudo vi /etc/ssmtp/revaliases

Add for root and other local users

root:[email protected]:smtp.live.com:25

 

Testing

ssmtp [email protected]

Next type the message in the following format:

To: [email protected]

From: [email protected]

Subject: Testing from Ubuntu!

 

If you can see this, it works!

There is a blank line after Subject, that’s very important. After the blank line, whatever you type becomes the body of the message. Once you’re done press Ctrl+D. It’ll wait for a few seconds and then send the message.

IMPORTANT: Currently, there is a daily limit to number of emails you can send through live.com, outlook.com or gmail.com. Exceeding the limit blocks all outgoing emails. Therefore, I would recommend, not setting “root” email address. Once you set it, things like cron job output also get sent to that email address. Second, if you use Webmin, create an environment variable called MAILTO in Cron module and set it to blank value. This way Cron would not try to send email output to root@servername.

2 thoughts on “Send emails from Ubuntu using your live.com address

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.