Sending email from Synology via CLI/SSH on DSM 6

Doing a quick Google search for sending emails from Synology via CLI/SSH talks about the sendmail command. However, this doesn’t work on DSM6 unless you install a package that provides the command.

You can install one of the following packages to get the sendmail command

  • Synology Mail Server
  • Synology MailPlus Server

Both allow you to set up an SMTP mail relay such as Gmail, Postmark, or Sendgrid. But that means you need to install and run these services. This is not ideal if you’re not using all the features of these applications.

Instead, you can look at using ssmtp which is installed by default and will use the built-in SMTP configuration that is present in the Synology Control Panel -> Notification -> Email.

You will have to make sure you use the appropriate email headers such as From: when piping in data to be sent via email like so.

echo "From: [email protected]\nthis is a test" | ssmtp [email protected]

You could also look at using Sendgrid or Postmark with Bash. There are two scripts that would work for this.

  • SendGrid

MikroTik Scripts

Setup SSH Key Login on Mikrotik

Created File and Place SSH Key Contents


Set SSH Key for Users


Setup Email Sending on Mikrotik via Postmark


Send a Test Email from Mikrotik


Backup Mikrotik Config and Email – Example 1


Backup Mikrotik Config and Email – Example 2