Community discussions

MikroTik App
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Email Log Setting

Wed Nov 17, 2010 2:06 pm

Hey guys,

I am trying to setup my router so it can email me when things go wrong>


do you know if i can use Gmail as my smtp cause it uses secure connection?


I have setup with another email account:

but when the RB logs, it says invalid TO address? do i have to do any thing special under logs where it says email?

i just put the email in there?

please help
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 2:31 pm

Take a look at this:
http://wiki.mikrotik.com/wiki/Email_set ... leshooting
If you have any questions after that, I might be able to help.

ADD: Normally, an "Invalid TO address" means you are trying to relay the email. If you use port 25 with gmail, it MUST be a gmail "TO" address.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 2:46 pm

I already had a look at that?

What must the smtp server address be?

i put in smtp.gmail.com is that right?

i have put in port 465
my user and password:

Does From:" " make any difference? does it matter whats in there?

to test the email i am tryping:
/tool e-mail send to=info@zapotel.co.za subject="test" body="test" tls=yes

the email account is with gmail apps:
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 2:49 pm

This is directly from the wiki article. Note the word "must":
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.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 2:57 pm

Does it matter if it have to have the < > on ends?
Set your "from" email address to something sensible, but it does not need to be a real email address that exists,
thats also in the wiki?
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 3:00 pm

Only if you use something like this. A Name prior to the email address:
SurferTim <myemail@mydomain.com>
But the domain name must exist. My email server rejects any email with a domain that it cannot resolve.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 3:04 pm

Ok still not working:
   server: 74.125.91.109:465
      from: "<info@zapotel.co.za>"
  username: "info@zapotel.co.za"
  password: "password"
it says smtp server not ready:

For the server i put in smtp.gmail.com and it dns'd it.

I have a feeling thats the problem?
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 3:08 pm

That username is not a gmail account. Is that how you log in to your gmail account?

This is not from my wiki article, and it is incorrect:
Set your "from" email address to something sensible, but it does not need to be a real email address that exists,
The domain MUST exist and the dns resolves, or almost any email server will reject it.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 3:13 pm

yea.

if i go to gmail.com

i can login with those.

I am using google apps as a mail server:

but now its giving the error;
SMTP server not ready
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 3:18 pm

Are you using V4.x on this router? Are you adding the "tls=yes" to the end of the test email? If not, the port 465 gmail server will not respond.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 3:24 pm

4.11

and yes:
[admin@MikroTik] /tool e-mail> /tool e-mail send to=zapotechcomputers@zapotel.co
.za subject="test" body="test" tls=yes
Log Error:
15:16:01 system,e-mail,error Error sending e-mail: abnormal termination (timeout
)
Email code:
[admin@MikroTik] /tool e-mail> print 
    server: 74.125.47.27:465
      from: "<info@zapotel.co.za>"
  username: "info@zapotel.co.za"
  password: "password"
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 3:26 pm

Isnt there like just a open smtp server

that can send any thing:

and then it will just come through to my email from the name i put under from?

I just want it to email.
Does not have to email from gmail. I just want it to email to gmail.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 3:31 pm

Hi Zapnologica! Try a different port. I just went to the gmail site, and it says if you are using TLS, to use port 587 rather than 465.

I use port 25 to deliver to gmail accounts. If you search the forum, you will find quite a few posts about email from me.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 3:41 pm

ok i will try both ports:


can i just clarify what ip to use for smtp server?
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 3:44 pm

Here is the link to the setup page at google
http://mail.google.com/support/bin/answ ... swer=13287
It says smtp.gmail.com
It also mentions enabling POP for your account. Try that also.

ADD: I would really like to see this work. I will add it to the wiki when you get it working.
smtp.gmail.com resolves to this ip here: 74.125.65.109
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 4:04 pm

Well done u a star.


Ok for your wiki,

u must not give a ip.
say put in " smtp.gmail.com"
cause mine only worked when i did that,

And it worked on port 587 which makes sense when u read the Google page:


and the from field:
<name> does not work
<name@domain> does work
anyname works


and enable pop on ur gmail account.
Last edited by Zapnologica on Wed Nov 17, 2010 4:14 pm, edited 2 times in total.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 4:06 pm

Thanks! But it was you that did the troubleshooting.
I will update the wiki with what you learned from your setup.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 4:11 pm

One question: where did you use the "smtp.gmail.com"? Was that in "/tool e-mail" or the test email?
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 4:16 pm

wow,

i tried every possibily possible to man.

I was doing this in winbox.

If u put in smtp.gmail.com in smtp server field, it automatically resolves it for you. (where u would usualy put the ip)
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 4:19 pm

OK! That now makes sense! I use the CLI, and it does NOT do the resolution. It requires an ip and port. So each user will need to resolve the local ip for smtp.gmail.com. Good to know.

ADD: The addition has been made to the wiki.
http://wiki.mikrotik.com/wiki/Email_set ... leshooting
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 4:57 pm

Ok,

I found some thing odd,

If i send a email from terminal it works,

But when log tries to send a email it says:
invalid FROM address

but it works with terminal email?

What could be the problem.

I sent a email with terminal:

and then made it do a email log: here is the log:
16:57:44 e-mail,debug recv: 220 mx.google.com ESMTP h29sm1637283wbc.9 
16:57:44 e-mail,debug send EHLO [192.168.1.202] 
16:57:45 e-mail,debug recv: 250-mx.google.com at your service, [41.213.41.236] 
16:57:45 e-mail,debug recv: 250-SIZE 35651584 
16:57:45 e-mail,debug recv: 250-8BITMIME 
16:57:45 e-mail,debug recv: 250-STARTTLS 
16:57:45 e-mail,debug recv: 250 ENHANCEDSTATUSCODES 
16:57:45 e-mail,debug send STARTTLS 
16:57:45 e-mail,debug recv: 220 2.0.0 Ready to start TLS 
16:57:47 e-mail,debug send EHLO [192.168.1.202] 
16:57:48 e-mail,debug recv: 250-mx.google.com at your service, [41.213.41.236] 
16:57:48 e-mail,debug recv: 250-SIZE 35651584 
16:57:48 e-mail,debug recv: 250-8BITMIME 
16:57:48 e-mail,debug recv: 250-AUTH LOGIN PLAIN XOAUTH 
16:57:48 e-mail,debug recv: 250 ENHANCEDSTATUSCODES 
16:57:48 e-mail,debug send AUTH PLAIN AHJvdXRlckB6YXBvdGVsLmNvLnphAHphcG90ZWwsLi
8= 
16:57:49 e-mail,debug recv: 235 2.7.0 Accepted 
16:57:49 e-mail,debug send MAIL FROM: <router@zapotel.co.za> 
16:57:50 e-mail,debug recv: 250 2.1.0 OK h29sm1637283wbc.9 
16:57:50 e-mail,debug send RCPT TO: <zapotechcomputers@gmail.com> 
16:57:50 e-mail,debug recv: 250 2.1.5 OK h29sm1637283wbc.9 
16:57:50 e-mail,debug send DATA 
16:57:51 e-mail,debug recv: 354  Go ahead h29sm1637283wbc.9 
16:57:51 e-mail,debug send . 
16:57:53 e-mail,debug recv: 250 2.0.0 OK 1290005872 h29sm1637283wbc.9 
16:57:53 e-mail,debug send QUIT 
16:57:53 e-mail,debug recv: 221 2.0.0 closing connection h29sm1637283wbc.9 
16:59:31 system,error,critical login failure for user admin via winbox 
16:59:32 e-mail,debug recv: 220 mx.google.com ESMTP a17sm1637286wbe.18 
16:59:32 e-mail,debug send EHLO [192.168.1.202] 
16:59:33 e-mail,debug recv: 250-mx.google.com at your service, [41.213.41.236] 
16:59:33 e-mail,debug recv: 250-SIZE 35651584 
16:59:33 e-mail,debug recv: 250-8BITMIME 
16:59:33 e-mail,debug recv: 250-STARTTLS 
16:59:33 e-mail,debug recv: 250 ENHANCEDSTATUSCODES 
16:59:33 e-mail,debug send MAIL FROM: <router@zapotel.co.za> 
16:59:34 e-mail,debug recv: 530 5.7.0 Must issue a STARTTLS command first. a17sm
1637286wbe.18 
16:59:34 e-mail,debug send RSET 
16:59:34 e-mail,debug recv: 250 2.1.5 Flushed a17sm1637286wbe.18 
16:59:34 e-mail,debug send QUIT 
16:59:35 e-mail,debug recv: 221 2.0.0 closing connection a17sm1637286wbe.18 
16:59:35 system,e-mail,error Error sending e-mail: invalid FROM address

but while typing this i figured out my problem

i need to make all emails say tls=yes
Last edited by Zapnologica on Wed Nov 17, 2010 5:02 pm, edited 1 time in total.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 4:59 pm

What do you have set for "From" in the /tool e-mail settings? I must use a valid email address for the from address. Nothing else works for me.

ADD: Remove the "<" and ">" from your From address. That may cause a problem. It does not cause a problem with my email server.

Then you found the problem. And yes, the tls=yes must go with all your emails.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 5:15 pm

Well,

if i put "hello" in the from it still sends, no errors on router.

Comes into inbox from info@zapotel.co.za though not as "Hello" but no errors.



How do i set tls=yes for every thing?
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 5:19 pm

I see now. It is using your username from your login as the "from" address. Does that look about right? If you tried that "from" address with my email server, it will not accept it.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 5:26 pm

Oh,

google must just change it then.

So now how do i set tls=yes like globaly,

Cause i cant do anything with email besides when i manualy type in to send a message,

cause it needs to say tls=yes, and when a log tries to send a email it dont do that.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 5:32 pm

I am not certain what you mean by the log sending you an email. Where are you setting your router to send an email? I see no way in "/log" to send an email.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 5:42 pm

under system,

logging

you can add a log type called email,

where it emails you the log,

now when that log tries to email me, it is ov not adding the " tls=yes " at the end of the command.

Any way i can do that?

I think mikrotik needs to add it in v5 rOS, under tools e-mail u must choose encryption or not.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 5:53 pm

Are you talking about "/system logging" and the "topics=e-mail" entry? That only puts e-mail server entries in the log. It doesn't email anything.
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: Email Log Setting

Wed Nov 17, 2010 7:36 pm

In Gmail, you also have to set https mode.
Settings -> General -> Browser connection: Always use https

Also, here are my settings for email in Mikrotik:
/tool e-mail
set from=example@gmail.com password=<password> server=74.125.127.109:587 username=example@gmail.com
In my experience, the from= and username= MUST be your full gmail address (with no quotes or < or >).

This works great for me.

EDIT: I did some tests with logging to email from /system logging and as stated above it doesn't work.
I emailed support@mikrotik.com, and am awaiting response...
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Wed Nov 17, 2010 9:00 pm

Are you talking about "/system logging" and the "topics=e-mail" entry? That only puts e-mail server entries in the log. It doesn't email anything.
Nope,

that is what logs email entires,

If u go System loggin actions

u can add a new action,
type email;

u chose the to address.

Then u can make certain topics get emailed to you.
The reason it dont work is cause u need tls to be enabled, but when log tries to send the email it does not enable tls and it therfore does not work it gives the error:
Invalid FROM address
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Wed Nov 17, 2010 11:34 pm

It should give you a timeout if it couldn't connect. If you still have the email server logging, what does it say about it?

ADD: My bad! I just tried it with my gmail account. No tls, then you get Invalid From address. :(
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Thu Nov 18, 2010 7:15 am

i posted the logs in a post before,

thats where i figured out my problem,

If you look, i sent a email with console and it worked then the 2nd one is log trying to send a email, and it does not use tls
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: Email Log Setting

Thu Nov 18, 2010 9:17 am

And Gmail just moved to https by default too (although this is a good thing). Hope Mikrotik will fix this:
I suggested two fixes in the email I sent to Mikrotik support:
1) A global tls= setting in /tool e-mail that will be applied by default to any emails sent from Mikrotik
2) A specific tls= setting only applied in /system logging action <...> target=e-mail

What do others think is the best solution? Or other ideas?
 
accessmd
newbie
Posts: 35
Joined: Sat May 22, 2010 9:40 am

Re: Email Log Setting

Thu Nov 18, 2010 9:52 am

Can anyone please help and post configuration that worked. I cannot get this to work for me.
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: Email Log Setting

Thu Nov 18, 2010 9:56 am

Can anyone please help and post configuration that worked. I cannot get this to work for me.
Did you read any above posts? I mentioned a fix with /tool e-mail send.
As for /system logging <...> action=email, this does not work if TLS is required.

To make this work, one workaround would be to set up your own email server or use a server that does not require TLS. Have you done this? What have you tried so far?
 
accessmd
newbie
Posts: 35
Joined: Sat May 22, 2010 9:40 am

Re: Email Log Setting

Thu Nov 18, 2010 11:40 am

Can anyone please help and post configuration that worked. I cannot get this to work for me.
Did you read any above posts? I mentioned a fix with /tool e-mail send.
As for /system logging <...> action=email, this does not work if TLS is required.

To make this work, one workaround would be to set up your own email server or use a server that does not require TLS. Have you done this? What have you tried so far?
It works with gmail only. when i use my own email domain, it still shows error. My mail server allows for tls and none tls and i still have the same error:
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Thu Nov 18, 2010 1:10 pm

 server: 209.85.229.109:587
      from: "zapoelrouter"
  username: "router@zapotel.co.za"
  password: "urpassword"
i used winbox and for server i typed in" smtp.gmail.com " and it resolved it by its self.

This config works, but not with log, only with custom sent emails,

u have to have tls=yes at the end of ur email command for it to work.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Thu Nov 18, 2010 3:44 pm

@Zapnologica: Check your gmail inbox for a "SurferTim test". From a RB433ah using port 25 (no tls) to your email address. It must be To the email address that this test email is addressed to. That is a gmail.com address.
In a script you can set the server to another ip and port (578) and tls=yes in the script for all other email.
/tool e-mail
set server=74.125.65.27:25
You might not be able to reply to that email. I used a valid domain, but possibly a bogus user.
 
Zapnologica
Long time Member
Long time Member
Topic Author
Posts: 594
Joined: Fri Sep 25, 2009 8:15 pm
Location: South frica

Re: Email Log Setting

Thu Nov 18, 2010 3:51 pm

i got the email:

So u saying i must not use tls.

I must use port 25?
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Thu Nov 18, 2010 3:59 pm

If you want to use the email-to=username@gmail.com for the log email, you should try the ip and port I sent (edit: posted above actually). It is a different ip. No username or password set in "/tool e-mail", just the server and a "From" address with a valid domain. The "to" address MUST be to a xxx@gmail.com address for this to work.

In a script, you can use this (a bit bulky). The "send" is all one line.
/tool e-mail
send server=209.85.229.109:587 to=user@otherdomain.com username=user password=pwd  subject="test" body="test" tls=yes
FYI: I know how it must look, but just so you know, I am not a spammer.
 
User avatar
SeaburyNorton
Frequent Visitor
Frequent Visitor
Posts: 65
Joined: Tue Sep 28, 2010 9:39 pm

Re: Email Log Setting

Thu Mar 10, 2011 9:13 pm

Any reply from Mikrotik on this?
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Email Log Setting

Thu Mar 10, 2011 10:40 pm

Any reply from Mikrotik on this?
Reply to what? It is working. If you have a specific challenge, start another thread with your problem.
This wiki may help:
http://wiki.mikrotik.com/wiki/Email_set ... leshooting

ADD: In V5.x, there is supposed to be a tls setting in "/tool e-mail" so you can set "tls=yes" there.

Who is online

Users browsing this forum: Google [Bot], scoobyn8 and 51 guests