Community discussions

MikroTik App
 
danielcraig
just joined
Topic Author
Posts: 1
Joined: Mon Mar 17, 2025 5:14 am
Location: https://chillguygame.io

Why Won’t My Email Alert Work?

Mon Mar 17, 2025 5:21 am

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!
 
User avatar
MickeyT
Member Candidate
Member Candidate
Posts: 143
Joined: Tue Feb 18, 2020 7:06 am
Location: Australia

Re: Why Won’t My Email Alert Work?

Mon Mar 17, 2025 8:20 am

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:

RouterOS v6 code

/export hide-sensitive file=MyConfig

RouterOS v7 code

/export file=MyConfig