Setup And Troubleshooting Routeros Email Function - MikroTik Script RouterOS
Insure you have the basic router setup complete. Ip address, default route, and DNS. NTP client is recommended.
Enable logging for the email service.
/system logging add topics=e-mail action=memory
This will put e-mail messages in the system log, and makes troubleshooting easier.
Go to "/tool e-mail".
Enter the email server ip. If your email service allows you to send email with a username and password, you may use the email server ip provided by your ISP. If not, use the ip of the email server that handles the domain for the destination email address. No user or password entered for this.
Enter the from address. This must be a valid format and domain. Insure you enter this from address in your address book or friends list in your email reader and provider, or it could be mistaken for spam.
Enter a username and password only if the email server requires it. If you are using the destination email address email server, leave the user and password blank
For gmail users, use the "tls=yes" setting below, and use port 587. You should resolve an ip for smtp.gmail.com locally to determine the ip to use for the server setting. Winbox will do this for you. The CLI will not. You must also go to your gmail account setup and enable POP.
Try a test email.
/tool e-mail send email@example.com subject="test" body="test"
or if your email server requires a secure connection
/tool e-mail send firstname.lastname@example.org subject="test" body="test" tls=yes
Check "/log", then your email account, for the result.
If you need to check a non-secure connection to the email server from the router:
/system telnet xx.xx.xx.xx 25
Replace x's with the email server ip in "tool e-mail", and the server should respond with
220 server.domain.com ESMTP xxxxxxxxxx
Type 'quit' to terminate the telnet connection from the email server.
If the connection fails, it may be due to your ISP blocking port 25, or the server requires a secure connection.
If the connection is refused, it may be the email server not accepting email from your ip, either temporarily or permanently.
If the server responds with a domain name that is not what you would expect from that server, your ISP may be redirecting your outbound email, or the dns setting is incorrect.