cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
12823
Views
19
Helpful
34
Replies

eem on cisco 877, trouble with mail server action and smtp auth

smanet
Level 1
Level 1

hello all,

i'm using a router 877 at home and i really need to check out what this router do during the day.

So some time ago i configured it using some eem actions and sending to me email, without any problems.

Yesterday I changed my internet provider and now i need to use smtp autheticantion to send emails.

I read about how to authenticate, like username:password@host and also made a fast search here, without solve my problem.

I need to put as username the email of the provider like: mouse@host.com:mypassword@smtpserveraddress.com.

So, i want to know if someone had the same problem and solved it. Of course i couldn't use @ two times or eem would think that host.com is my smtp server! And right now is going in this way!

My IOS version is 15.1(2)T2, eem version is 3.1.

Hope someone could help me!

Thank you in advance.


Sandro

34 Replies 34

Hello,

Thank you very much in advance for any help you can offer. Debugging I get this but stunnel.conf is edited and started

%HA_EM-3-FMPD_SMTP: Error occured when sending mail to SMTP server: smtp.gmail.com : error in reply from SMTP server

Router Cisco 877 with IOS version is 12.4(15)T16


Router Config:

ip host gmail.com pc_host*

!

track 1 rtr 1 reachability

delay down 10 up 60

!

ip route 0.0.0.0 0.0.0.0 Dialer0 track 1

!

ip sla 1

icmp-echo 8.8.8.8 source-interface Dialer0

timeout 2000

frequency 4

ip sla schedule 1 life forever start-time now

event manager environment to@gmail

event manager environment from@gmail.com

event manager environment smtp.gmail.com*

event manager applet TRACK-1-OK

event track 1 state up

action 1.0 mail server "smtp.gmail.com" to "to@gmail.com" from "from@gmail.com" subject "E2E up/down" body "DSL is UP"*

* I use several possible key combinations:

ip host smtp.gmail.com pc_host

event manager environment from@email.com:password@smtp.gmail.com

action 1.0 mail server "from@gmail.com:password@smtp.gmail.com" to "to@gmail.com" from "from@gmail.com" subject "E2E up/down" body "DSL is UP"*

stunnel.conf config:

cert = stunnel.pem

socket = l:TCP_NODELAY=1

socket = r:TCP_NODELAY=1

client = yes

options = NO_SSLv2

[pop3s]
accept  = 110
connect = pop.gmail.com:995

[imaps]
accept  = 143
connect = pop.gmail.com:993

[ssmtp]
accept  = 25
connect = smtp.gmail.com:465

Greetings,

Guiller

more debugging

Jan  6 15:45:59.474: %HA_EM-6-LOG: TRACK-1-OK : DEBUG(smtp_lib) : smtp_read 530 5.7.0 Must issue a STARTTLS command first. t10sm13587456wia.6 - gsmtp

Jan  6 15:45:59.474: %HA_EM-6-LOG: TRACK-1-OK : DEBUG(smtp_lib) : buffer no reply code matched: 530 5.7.0 Must issue a STARTTLS command first. t10sm13587456wia.6 - gsmtp

Jan  6 16:45:59.474 MET: %HA_EM-3-FMPD_SMTP: Error occured when sending mail to SMTP server: smtp.gmail.com : error in reply from SMTP server

Hi Guiller,

I saw in your script you were not using the environment variables in the same fashion as I had used above.  That's ok I think, they aren't entirely necessary depending on what type of needs you have.

The email address you are sending from needs to be a known gmail account that you have the credentials to obviously.

This line should be changed:

action 1.0 mail server "smtp.gmail.com" to "to@gmail.com" from "from@gmail.com" subject "E2E up/down" body "DSL is UP"*

Change it to the following:

action 1.0 mail server "from:password@gmail.com" to "to@gmail.com" from "from@gmail.com" subject "E2E up/down" body "DSL is UP" source-interface Vlan5 (Vlan5 can be replaced with the local Vlan interface your pc_host is connected to).

If that doesn't work, please try copying my example above exactly (of course replace your email addresses and passwords with your own).  If you choose to use the environment variables, then use _email_to, _email_from, and _email_server

If you use them like this then you can call on them in the action 1.0 mail server line:

event manager environment _email_to to@gmail.com

event manager environment _email_from from@gmail.com

event manager environment _email_server from:Passw0rd1@gmail.com

action 1.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "E2E up/down" body "DSL is UP" source-interface Vlan5.

Try that out and let me know how that works.  Also don't forget to check the stunnel logs as well, they can have some useful information to help you pinpoint the issue.

Justin

Hello, thanks Justin but this version (12.4.15.T17) dont allow object groups or apply the command for source-interface vlanX(local vlan) at the end of action 1.0 line. That was driving my nuts xD, I am testing it following your suggestions about environment variables and credentials.

According to the Embedded Event Manager configuration Guide "Based on RFC 2554, the SMTP e-mail server name--Mailservername-- can be in any one of the following template formats: username:password@host, username@host, or host."

I am using the premise "username:password@host", and like host @gmail or @smtp.gmail.com.

Stunnel is running and debug when I force telnet from router Cisco to pchost with port 25. However, dont work when the applet run, checking router log, I get failed attemps connecting to mailserver.

Greetings

Hi Guiller,

Understood, sorry I wasn't sure what differences there were in IOS versions.  I believe I am on 15.3 so that explains the lack of source-interface option.

For your purposes, the server address must be username:password@gmail.com.  If you use username:password@smtp.gmail.com, the gmail server will not recognize these credentials in my testing. 

FYI, the reason that the router doesn't need smtp.gmail.com references in its config, is because stunnel makes sure that the username:password@gmail.com credentials get passed to smtp.gmail.com for you.  Hopefully that makes sense.

Let me know if you have any luck!

Thanks,

Justin

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: