Error Sending Email via Terminal and Script

Hi,
I added email settings via Tools > Email and then in Send Email. Its working perfectly when I send email (see snapshot).

I then added script in Tool > Traffic Monitor and I set threshold 1M

But when I try to send email via terminal or using script but its not working.

/tool e-mail send to=myuser@domain subject=“test” body=“test”

I tried this as well

/tool e-mail send to=“myuser@domain” subject=“Download”
body=“$[/system clock get date] - $[/system clock get time]”

Also

/tool e-mail set address=mailserver port=587 from=user user=user@mailsesrver password=sasa start-tls=yes
/tool e-mail send to=tome@mailserver subject=“test” body=“test”

I am receiving Error sending email, error connecting to server in logs.

Mikrotic Device: RB3011UiAS
Version: 6.43.16 (long-term)

Thanks in advance
Untitled.png

I’m using the same settings as on main settings. still not connecting/sending email.

Thanks will consider to upgrade. Should I use stable version or LT?

First: upgrade your device, is ridicoulusly old… 6.43.16 from 2019/05/15 and full of backdoor.

I suggest everytime the long-term 6.47.10

Second: on picture you use different settings for sending test mail…
You do not think to use THAT settings on main settings?

start-tls=yes ≠ start-tls=tls-only

I tried with tls and without tls. The thing is its sending email when I press send email.

But its not working on terminal and in script.

So I’m thinking it might work after upgrade.

Try with start-tls=no (or =tls-only) ?

I tried via terminal with tls option and without tls.

Same error

Error sending email. Error connecting to server

Update: Upgraded to 6.47.10 LT

Hi,
I tested again today by sending an email via GUI (Tools > Email > Send Mail) and then I checked it and I received to my email address.

[@MikroTik] > /tool e-mail print
address: mail.domain.com
port: 587
start-tls: yes
from: notification@domain.com
user: notification@domain.com
password: ----
last-status: succeeded

But failing on terminal.

Update:
I tried this command (with mail server IP as well)

/tool e-mail send to=“me@domain.com” subject=“test”
from=“notification@domain.com” server=“mail.domain.com:587
user=“notification@domain.com” password=“—”

In logs, it says
Error sending e-mail : DNS resolve failed

Any idea how to resolve?
Thanks

server=“mail.domain.com:587” ???

server=“mail.domain.com” port=587 ???

Thanks for the reply,

Some how I used IP of mail sever again today and it worked via terminal