Dude - Email notifications through Gmail on Windows - via blat

Slech, thanks for your help.. I did it with the other option that you said before Mailsend.exe, and now it is working perfectly..

Now, here is another question.. I am using The Dude to monitore Mikrotik Routers that are running BGP and OSPF.. do you know if I can use those Email Notifications to let me know if the BGP or OSPF goes down??

carlossu, you are welcome!
You can start with probes on this topic: Probe Thread

Also found on the forum:
MIkrotik BGP Monitoring
Email me if BGP session status in NOT established
Monitoring OSPF path status, is it possible?

Really helpful article. I am new with Windows 8 and your article helped me to understand how the e-mail works with the Windows. I was confused how to send to two e-mail address and your thread helped me to fix these issues and clarify many doubts. Great job. You can submit this to twc internet to help all Windows users.

Hi!
My local network behind a proxy server. And for the correct operation of the notification dude, you must specify the proxy settings in the configuration -serverv stunnel.
This my working config given a proxy server:
(I used SMTP server Yandex. Why it is only through it the connection was successfully.)

Stunnel:

socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
#debug = 7
#output = stunnel.log

[ssmtp]
accept = 465
client = yes
connect = 192.168.XXX.XXX:8080
protocol = connect
protocolAuthentication = basic
protocolUsername =your_proxy_login
protocolPassword =your_proxy_password
protocolHost = smtp.yandex.ru:465

#debug = 7
#output = stunnel.log - disabled after debugging

192.168.XXX.XXX:8080 - proxy server

Blat:

rem @echo off
 
set dir=C:\blat
set logname=%dir%\blat.log
set smtpsender=dude-XXXXXX@yandex.ru
set smtpserver=127.0.0.1
set smtpport=465
set smtpuser=dude-XXXXXX@yandex.ru
set smtppwd=XXXXXXXXXX
set mailto=XXXXXXXXXXXXX@gmail.com
set subject=%1
set body=%2


IF NOT EXIST %logname% echo ====================== Start of file ====================== > %logname%
echo. >> %logname%
echo ====================== %time% ====================== >> %logname%


C:
CD %dir%
echo CMD: blat.exe -to %mailto% -f %smtpsender% -server %smtpserver% -port %smtpport% -u %smtpuser% -pw %smtppwd% -subject %subject% -body %body% >> %logname%
blat.exe -to %mailto% -f %smtpsender% -server %smtpserver% -port %smtpport% -u %smtpuser% -pw %smtppwd% -subject %subject% -body %body% >> %logname%

set smtpsender=set smtpuser=your accaunt yandex
set smtppwd=your password yandex
set mailto=but you can specify any address - what you need. I have tried the service Beeline 7909XXXXXXX@sms.beemail.ru. It works, but SMS comes with a delay, and it is unacceptable. So I made ​​a notification to gmail and alert comes time for my smartphone.

Just use Mail Alert Simple Mailer:
https://sourceforge.net/projects/mail-alert/

You don’t need any makeshifts like Blat and Stunnel. Mail Alert supports SSL/TLS natively.

Hello Guys,

I tryed configuration of email notifications through gmail on windows, but not sends the nonifications. I have installed The Dude v3.6 on Windows Server 2012RH, I follow the steps but it does not work!!!

I need your help, this configuration is very importat in my company for monitoring the network.

I installed stunnel4.56 and blat3216_full, I edit stunnel.conf for these

stunnel.conf
Sample stunnel configuration file for Win32 by Michal Trojnara 2002-2012
; Some options used here may be inadequate for your particular configuration
; This sample file does *not* represent stunnel.conf defaults
; Please consult the manual for detailed description of available options

; **************************************************************************
; * Global options                                                         *
; **************************************************************************

; Debugging stuff (may useful for troubleshooting)
;debug = 7
;output = stunnel.log

; Disable FIPS mode to allow non-approved protocols and algorithms
;fips = no

; **************************************************************************
; * Service defaults may also be specified in individual service sections  *
; **************************************************************************

; Certificate/key is needed in server mode and optional in client mode
cert = stunnel.pem
;key = stunnel.pem

; Authentication stuff needs to be configured to prevent MITM attacks
; It is not enabled by default!
;verify = 2
; Don't forget to c_rehash CApath
;CApath = certs
; It's often easier to use CAfile
;CAfile = certs.pem
; Don't forget to c_rehash CRLpath
;CRLpath = crls
; Alternatively CRLfile can be used
;CRLfile = crls.pem

; Disable support for insecure SSLv2 protocol
options = NO_SSLv2
; Workaround for Eudora bug
;options = DONT_INSERT_EMPTY_FRAGMENTS

; These options provide additional security at some performance degradation
;options = SINGLE_ECDH_USE
;options = SINGLE_DH_USE

; **************************************************************************
; * Service definitions (at least one service has to be defined)           *
; **************************************************************************

; Example SSL server mode services

socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
;debug = 7
;output = stunnel.log

client = yes

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

[ssmtp]
accept  = 465
connect = smtp.gmail.com:465
[/color]
; Example SSL client mode services

;[gmail-pop3]
;client = yes
;accept = 127.0.0.1:110
;connect = pop.gmail.com:995

;[gmail-imap]
;client = yes
;accept = 127.0.0.1:143
;connect = imap.gmail.com:993

;[gmail-smtp]
;client = yes
;accept = 127.0.0.1:25
;connect = smtp.gmail.com:465

; Example SSL front-end to a web server

;[https]
;accept  = 443
;connect = 80
; "TIMEOUTclose = 0" is a workaround for a design flaw in Microsoft SSL
; Microsoft implementations do not use SSL close-notify alert and thus
; they are vulnerable to truncation attacks
;TIMEOUTclose = 0

; vim:ft=dosini

mailblat.cmd create the file

set blatdir=C:\Program Files\Dude\blat\mailblat.cmd
set smtpsender=XXXXXXXX@gmail.com
set smtpserver=127.0.0.1
set smtpport=465
set smtpuser=XXXXXXXXXX@gmail.com
set smtppwd=MYPASSWORD
set mailto=XXXXXXXXXXX@gmail.com
"%blatdir%\blat.exe" -to %XXXXXXXXX@gmail.com% -f %XXXXXXXXXX@gmail.com% -server %127.0.0.1% -port %465% -u %XXXXXXXXXX@gmail.com% -pw %MYPASSWORD% -subject %1 -body %2

The Dude v3.6 add the new notifications

Name: Email Externo
Type: Execute on server
(Insertar Variale)
Command: "C:\Program Files (x86)\Dude\blat\mailblat.cmd" "Service [Probe.Name] on [Device.Name] is now [Service.Status]" "Service [Probe.Name] on [Device.Name] is now [Service.Status] ([Service.ProblemDescription])"

The server have Private IP, the setting General on The Dude is:

Primary DNS: 4.2.2.1
Secondary DNS: 8.8.8.8

Primary SMTP: 74.125.141.108 (this IP I found when I do Ping smtp.gmail.com)
Secondary SMTP: 0.0.0.0
From: XXXXXXXX@gmail.com

Please could you help me!!!

Hello, edgars04!

Can you try the following solution: Dude - Email notification through Gmail on Windows - via mailsend.
If not, we can continue to solve your issue with blat.

Thank you!

Thanks for you help Slech!!!

I will try the configuration with mailsend.

Hello slech , can you help me
for some reason it stop sending me
didn’t change any setting of my files in the last 2 years
I get :

2016.11.10 13:21:14 (Thu)------------Start of Session-----------------
Blat v3.2.0 (build : Dec 27 2013 14:37:23)
32-bit Windows, Full, Unicode
Error: Server refused connection.
2016.11.10 13:21:15 (Thu)-------------End of Session------------------

this is the stunnel.conf

socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
debug = 7
output = stunnel.log
client = yes
[pop3s]
accept = 995
connect = pop.gmail.com:995
[ssmtp]
accept = 465
connect = smtp.gmail.com:465

and this is the cmd file

::
:: Send email notifications from Dude via Gmail
::
set blatdir=C:\Program Files\Dude\blat
set smtpsender=> MyEmail@gmail.com
set smtpserver=127.0.0.1
set smtpport=465
set smtpuser=MyEmail
set smtppwd=MyPassword
set mailto=david@gmail
set mailcc=> david1@korenron.co.il
::
::
::“%blatdir%\blat.exe” -to %mailto% -cc %mailcc% -f %smtpsender% -server %smtpserver% -port %smtpport% -u %smtpuser% -pw %smtppwd% -subject %1 -body %2
::
:: Uncomment for debug only (Comment previous line. Do not forget to return back after debugging!!!)
::
“%blatdir%\blat.exe” -to %mailto% -f %smtpsender% -server %smtpserver% -port %smtpport% -u %smtpuser% -pw %smtppwd% -subject “Test subject” -body “Test body” -debug -log emailbtal.log
::
::pause
::

what could it be?
I have try to enter to account with the user\pass - and it’s working , so this is not the issue

Thanks,

Hello, David1234!

As I see in your stunnel.conf, your log is enabled. Please verify that stunnel working and if yes, can you look in its log file.

This solution working using stunnel for secure connection and it receiving connection from the blat and then connect to the gmail.

Thank you!

I’m sorry - but i didnlt understand what you want me to do

how can I know if my stunnel is working? I don;t see any log file in it’s folder.
?

Thanks ,

David1234,

  1. Stunnel should work as a Windows service. To verify if it is running:
    Win+R → Services.msc → Enter → Find Stunnel and verify its state. If it is not running - “Start” it.
  2. As your stunnel debug is turned on, in stunnel.logu you should see something if it working. I think this file should be in the stunnel installation folder.
  3. Try a connection to the Gmail directly and using stunnel:
    a)telnet smtp.gmail.com 465
    b)telnet localhost 465
    And notice if connection is established.

Also you can try to move on another solution which not require a stunnnel: Dude - Email notification through Gmail on Windows - via mailsend.

Thank you!

I think the problem was that the servids wasn’t running…

strange but at least we found it

Thanks !

Why you are still using Blat with stunnel? There is a better solution like Mail Alert Simple Mailer (https://sourceforge.net/projects/mail-alert/) which natively supports SSL/STARTTLS and stores encrypted SMTP password in configuration file.