Community discussions

MikroTik App
 
pjulian
Member Candidate
Member Candidate
Topic Author
Posts: 267
Joined: Mon May 31, 2004 12:16 pm
Location: Sydney, Australia

Alternate SMTP port for notifications

Sat Feb 13, 2010 2:48 pm

Hi guys, we occasionally have an issue with our SMTP/SPAM server and have an issue that if it's after hours we cannot get notified about it because our SMTP/SPAM server is what is used to send notifications.

On our mail server we have our spam system taking the brunt of SMTP connections on port 25, once the email is checked it heads to the mail server on port 2500.

Every time we have had a problem the mail server itself is working, but the spam system has had an issue, so If I can send emails to port 2500 instead of port 25 we would still get the email, however if I sent it to an external mail server it can't get back in.

I have tried specifying the different port number on the smtp server address like 1.2.3.4:2500 but it doesn't work.

Does anybody have a workaround that might help in this situation ? The only idea I have come up with is a port redirection on the lan port of our router which will listen on port 25 and then redirect to port 2500 on the mail server, not really a good solution I don't think.....

Thanks
Paul
 
User avatar
mpegmaster
just joined
Posts: 5
Joined: Fri Oct 02, 2009 6:16 am
Location: Artesia, CA. - USA

Re: Alternate SMTP port for notifications

Mon Feb 15, 2010 1:16 am

Try using this... But modify it for your environment!!!

Requirements: blat + stunnel + dude server on windows machine + your email account

Modified from...
http://forum.mikrotik.com/viewtopic.php ... ilit=gmail

Although this shows its use for Gmail, this should still work for you... "stunnnel" is the SSL
provider for 'the Dude' & "Blat" is the Mail agent.

Download and install 'stunnel' and the 'Blat' software...

To verify if 'stunnel' is working... @ the Command Prompt
telnet localhost 2500
or
telnet xxx.xxx.xxx.xxx 2500
"Should get something like this... 220 mx.xyzabc.com ESMTP 9sm2309658agb.29" if not check the 'stunnel.conf' file!!!

Here is a example... emailblat.cmd

<-Begin of File->

set dir=c:\Program Files\Dude\blat
set smtpsender=yourname@xyzabc.com
set smtpserver=127.0.0.1
set smtpport=2500
set smtpuser=yourname
set smtppwd=password
set mailto=123@xyzabc.com, 456@xyzabc.com, 789@xyzabc.com

"%dir%\blat.exe" -to %mailto% -f %smtpsender% -server %smtpserver% -port %smtpport% -u %smtpuser% -pw %smtppwd% -subject %1 -body %2 -ps "C:\Program Files\Dude\blat\dude-email.txt"
<-End of File->

Here is a example of... stunnel.conf

<-Begin of File->

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

CAfile = cert.pem

client = yes

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

[ssmtp]
accept = 2500
connect = smtp.xyzabc.com:2500
<-End of File->

Create a new Notification in the... Main Services... Polling... of 'the Dude'
Name:Email blat
Type:execute on server


Insert this into the "Insert Variable Command Box"...
"c:\Program Files\Dude\blat\emailblat.cmd" "Service [Probe.Name] on... [Device.Name] is now...[Service.Status]" "Service [Probe.Name] on... [Device.Name] is now... [Service.Status] ([Service.ProblemDescription]) @ [TimeAndDate]"

Explanation of above...

Call the Mail Agent... "c:\Program Files\Dude\blat\emailblat.cmd"

Insert SUBJECT into email... "Service [Probe.Name] on... [Device.Name] is now...[Service.Status]"

Insert BODY Text into email... "Service [Probe.Name] on... [Device.Name] is now... [Service.Status] ([Service.ProblemDescription]) @ [TimeAndDate]"

Now if you want to add a closing signature to the above...

Notice the... -ps "C:\Program Files\Dude\blat\dude-email.txt" in the... emailblat.cmd

If you want to make a TEST EMAIL CMD file make this...

Here is a example... test.cmd

<-Begin of File->

set dir=c:\Program Files\Dude\blat
set smtpsender=yourname@xyzabc.com
set smtpserver=127.0.0.1
set smtpport=2500
set smtpuser=yourname
set smtppwd=password
set mailto=123@xyzabc.com, 456xyzabc.com, 789xyzabc.com

"%dir%\blat.exe" -to %mailto% -f %smtpsender% -server %smtpserver% -port %smtpport% -u %smtpuser% -pw %smtppwd% -subject abc -body test -ps "C:\Program Files\Dude\blat\dude-email.txt"
<-End of File->

Example of... dude-email.txt

<-Begin of File->
Cheers!!!

From... yourname@xyzabc.com

** * * Your Name Here * * **
--- Network IP Watch Service ---
<-End of File->

This does work... I have made different ones for various party/'s needing notification within and outside network restraints.

CHEERS...& Good Day!!!

Who is online

Users browsing this forum: No registered users and 5 guests