Tag Archives: SSMTP

Fix Sending emails from Webmin

If Webmin is unable to send emails, for example, from automated backups, then following fix may work for you.

Before this ensure you have some kind of mail configured on your system. If not, here’s a guide to configure ssmtp

Basically, you need to go to Webmin Configuration and check “Sending Email” configuration. For me, it was a matter of setting “From” address. Quite simple, but took me hours to figure out..

Webmin_Sending_Email

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 [email protected]