Skip to content
Back to Blog
MikroTik

Email Alerts from MikroTik: Setup and Scripting

Configure MikroTik to send email alerts for interface down events, high CPU, reboot detection, and daily status reports.

Sep 2026
10 min read

Sending Email Alerts from RouterOS

RouterOS has a built-in email client that can send messages through any SMTP server. Combined with scripts and Netwatch, you can set up automatic email alerts for network events like link failures, high CPU usage, or unauthorized access attempts.

Configuring the Email Client

All email settings live under:

TEXT
/tool e-mail

Basic SMTP Configuration

TEXT
/tool e-mail set server=smtp.gmail.com port=587   start-tls=yes   from=router@example.com   user=router@example.com   password=your-app-password

Parameters:

  • server — SMTP server hostname or IP
  • port — typically 587 (STARTTLS) or 465 (SSL) or 25 (plain)
  • start-tls — enable STARTTLS encryption (yes recommended)
  • from — the sender email address shown to recipients
  • user — SMTP login username (usually the email address)
  • password — SMTP password or app password

View Current Settings

TEXT
/tool e-mail print

Using Gmail as SMTP

Gmail requires an App Password (not your regular password) when two-factor authentication is enabled.

  1. Go to your Google Account → Security → App Passwords
  2. Create an app password for "Mail" on "Other device"
  3. Use that 16-character password in RouterOS
TEXT
/tool e-mail set server=smtp.gmail.com port=587   start-tls=yes   from=youraddress@gmail.com   user=youraddress@gmail.com   password=abcd1234efgh5678

Sending a Test Email

TEXT
/tool e-mail send to="admin@example.com" subject="Test from MikroTik" body="This is a test email."

Wait a few seconds and check your inbox. If it does not arrive, check /log for errors:

TEXT
/log print where topics~"e-mail"

Triggering Alerts from Scripts

Alert When a Script Runs

TEXT
/system script add name=send-alert source={
  /tool e-mail send     to="admin@example.com"     subject="MikroTik Alert"     body="An important event occurred on the router."
}

High CPU Alert

Combine with the scheduler to check CPU usage periodically:

TEXT
/system script add name=cpu-alert source={
  :local cpu [/system resource get cpu-load]
  :if ($cpu > 80) do={
    /tool e-mail send       to="admin@example.com"       subject="High CPU Alert"       body=("CPU load is: " . $cpu . "%")
  }
}

/system scheduler add name=cpu-check interval=5m   on-event="/system script run cpu-alert"

Interface Down Alert

TEXT
/system script add name=ether1-down-alert source={
  /tool e-mail send     to="admin@example.com"     subject="Interface Down"     body="ether1 has gone down on the router!"
}

Use this with Netwatch or an interface monitoring script.

Triggering Email from Netwatch

TEXT
/tool netwatch add host=8.8.8.8 interval=30s timeout=2s   down-script="/tool e-mail send to="admin@example.com" subject="WAN DOWN" body="Primary WAN is unreachable!""   up-script="/tool e-mail send to="admin@example.com" subject="WAN UP" body="Primary WAN is back online.""

Note the escaped quotes (") inside the netwatch script strings.

Including System Information in Emails

TEXT
/system script add name=status-email source={
  :local cpu [/system resource get cpu-load]
  :local mem [/system resource get free-memory]
  :local uptime [/system resource get uptime]
  :local body ("CPU: " . $cpu . "% | Free Mem: " . $mem . " | Uptime: " . $uptime)
  /tool e-mail send     to="admin@example.com"     subject="Daily Router Status"     body=$body
}

/system scheduler add name=daily-status interval=1d start-time=07:00:00   on-event="/system script run status-email"

This sends a daily status report every morning.

Troubleshooting Email

If emails are not sending:

  1. Check the log for SMTP errors:
TEXT
/log print where topics~"e-mail"
  1. Verify DNS — the router must be able to resolve smtp.gmail.com:
TEXT
/ip dns cache print
:put [:resolve smtp.gmail.com]
  1. Check firewall — outbound port 587 or 465 must not be blocked
  1. Try port 25 if 587 fails — some ISPs block non-standard SMTP ports outbound
  1. Use IP instead of hostname if DNS is the issue:
TEXT
/tool e-mail set server=74.125.133.109

Security Tips

  • Do not store your main email password on the router — use app passwords or a dedicated account
  • Consider creating a dedicated "router alerts" Gmail or similar account
  • Rotate app passwords periodically
  • Limit who can access /tool e-mail settings via user profiles

Summary

  • Configure SMTP under /tool e-mail set
  • Send emails with /tool e-mail send to=... subject=... body=...
  • Use Gmail with App Passwords for easy setup
  • Combine with scripts and Netwatch for automatic event-based alerts
  • Check /log for SMTP errors when troubleshooting