Why Won’t My Email Alert Work?

Hey, I’m trying to set up a MikroTik script to monitor traffic on ether1 and send an email if it goes above 1MB. I wrote this script, but it’s not working as expected - sometimes it doesn’t send the email, and I’m seeing an error in the log that says ‘input does not match any value of name’. Here’s my code:

/interface monitor-traffic
:local rxTraffic [/interface get [find name="ether1"] rx-byte]
:if ($rxTraffic > 1000000) do={
  /tool e-mail send to="admin@example.com" subject="High Traffic Alert" body="Traffic on ether1 exceeded 1MB!"
} else {
  :log info "Traffic normal on ether1"
}

Can anyone spot what’s wrong? I’m new to MikroTik scripting and could use some help!

Your line:

/tool e-mail send to="admin@example.com" subject="High Traffic Alert" body="Traffic on ether1 exceeded 1MB!"

Doesn’t tell the system what email server or port needs to be used when sending emails. Have you configured the SMTP server settings for your system?

Take a look at this page for more information on configuring the SMTP server settings on your MikroTik.


Backups are your friend. Always make a backup!

/system backup save encryption=aes-sha256 name=MyBackup

Please, export and attach your current config to your post if you want help with a config issue:
/export hide-sensitive file=MyConfig/export file=MyConfig