e-mail tool broken in v3.11 and v3.13

Scripts that worked under v3.10 now no longer work in 3.11 or 3.13, the scripts run through fine but I get an error in the log

21:15:42 system,e-mail,error Error sending e-mail: invalid TO address

I’ve tried even just going into terminal and doing a simple test

/tool e-mail send from=test@example.com to=test@example.com subject=test body=test server=<ip address>

which gives exactly the same error. (used actual addresses in the test, just replaced with test@example.com)

I tested this twice on my x86 3.11 box and it works without any error messages. This is delivering a message to an internal exchange server.

Then I tested from a 433 3.13 router and it worked.

Then I tested from a 433 3.11 router and it worked.

would you be able to paste what you tested? (just changing email address and server of course)
I’ve tried this on 3 different boxes now with no luck. (3.11, 3.13, 3.13)

The TO address that it is simply name@example.com.au (have also tried info@example.com.au)

use quotes around the values.

also- turn on packet sniffer for port 25 and see whats actually being send/received. You’ll probably find that the receiving server is rejecting it, and the error you are seeing isn’t correct.

Mine is ok. My /tool e-mail settings are correct, so I don’t need the “from” or “server” parameters.
[admin@test] /system script> /tool e-mail send to=“myemail@mydomain.com” subject=“test” body=“testing”
and it went right through from both RB333/V3.11 and RB433AH/V3.13

I did not use that email address, of course!

tried with quotes and without, using a variable and using a direct name, can’t see any port 25 connections from the MT when doing a torch, nor on the remote mailserver.

Is running on a powerrouter 732, will try a downgrade and upgrade to see if it makes any difference.

Sorry the mikrotik smtp server seems to not want to send me mail any more.

On a RB433 running 3.13

/tool e-mail send to=hiltonr@gmail.com subject=test body=icle

is your output firewall chain blocking it ? turn on packet sniffer on the internet facing interface and select only port 25. torch will make it hard to see if its too fast.

Does this give you the “invalid TO address” error message?

This works for me. RB433AH/V3.13

/system backup save name="test.backup"
/tool e-mail send file="test.backup" to="youremail@yourdomain.com" subject="Backup" body="Backup"

Not that email address of course.
I do have the “server” and “from” set in
/tool e-mail.

trust me, the ONLY way you will know is to watch the actual SMTP conversation happen. The RouterOS errors for email do not correspond to what is actually happening. Use packet sniffer or review the mta logs directly. The smtp client is NOT very flexible, the server has to give it carte blanche : )

Oh, sorry. I thought getting it in my email box was good enough. :wink:

ADD: If you are still having challenges, try a delay between them. I have noticed the “execute” command is not what I thought. I expected the called script would complete before my routine would continue. NOT!! They run as a fork, not as a subroutine. Maybe same here?

/system backup save name="test.backup"
:delay 10
/tool e-mail send file="test.backup" to="youremail@yourdomain.com" subject="Backup" body="Backup"

You can use execute as a subroutine call.

:global done false
:execute testroutine
:while (!$done) do={:nothing}

and in the testroutine “subroutine” script

:global done
#do your stuff here
#then last thing
:set done true

OP - experiment with the TO mail address, maybe there is something wrong with the address itself. Try another domain, like some gmail address

I just tried this:
/tool e-mail send to=“badmail” subject=“test” body=“test”
and sure enough, I got the log entry. It must be an address formatting error to generate that message.

I tried a bogus email with a good format, and my box sent it, but the email server sent me a “nasty-gram” about it after the fact.

[admin@Krusher] > tool e-mail send server=“203.16.214.182” subject=“test” to=“krusher00@.com” from=“krusher_00@.com” body=“test”
[admin@Krusher] > tool e-mail send server=“203.16.214.182” subject=“test” to=“krusher00@.com” from=“krusher_00@.com” body=“test”
[admin@Krusher] > tool e-mail send server=“203.16.214.182” subject=“test” to=“krusher00@.com” from=“krusher_00@.com” body=“test”

(203.16.214.182 is my home adsl providers server)

10:52:07 system,e-mail,error Error sending e-mail: invalid TO address
10:52:32 system,e-mail,error Error sending e-mail: invalid TO address
10:52:35 system,e-mail,error Error sending e-mail: invalid TO address

/me tries another email server

email goes

:open_mouth:

Checking with torch helped to see what was actually being sent out, but yeah the TO address message is a bit deceptive :-/
I’ll work more on it and figure out what the problem is (perhaps my routing to that mailserver is a fault) thanks guys.

maybe the server didn’t like that address, and told it to the sender (ROS) which reported you the error

maybe server is requiring authentication, or is not accepting e-mails from weird hosts. ask your provider.

Will do, thank you for all the help.

Also, are there any plans to expand / build more detail into the email logging in the future?? I would appreciate it :slight_smile:

Check this thread:
http://forum.mikrotik.com/t/send-mail-with-script-or-netwatch-things-to-look-out-for/18321/1