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
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 126.96.36.199 source-interface Dialer0
ip sla schedule 1 life forever start-time now
event manager environment to@gmail
event manager environment firstname.lastname@example.org
event manager environment smtp.gmail.com*
event manager applet TRACK-1-OK
event track 1 state up
* I use several possible key combinations:
ip host smtp.gmail.com pc_host
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
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:
Change it to the following:
action 1.0 mail server "from:email@example.com" to "firstname.lastname@example.org" from "email@example.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 firstname.lastname@example.org
event manager environment _email_from email@example.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.
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.
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.
FYI, the reason that the router doesn't need smtp.gmail.com references in its config, is because stunnel makes sure that the username:firstname.lastname@example.org credentials get passed to smtp.gmail.com for you. Hopefully that makes sense.
Let me know if you have any luck!