 vipermCarpe DiemPremium join:2002-07-09 Winchester, CA | How to set up SMTP secure for DUDE server I dont see anywhere that allows me to choose what port to use for notifications under the SMTP settings? I guess they just assume everyone still uses port 25?
Anyway to change this option somewhere that I am missing? We dont host our own server anymore and all the SMTP settings are on secure port 995 |
|
 bburley join:2010-04-30 Cold Lake, AB | What I did was create an alert called "Email Alert" and set it to "execute locally" and passed variables to a VB script. I can't remember why "execute on server" didn't work, but "execute locally" runs the script on the server. The script also creates logs. This is the alert; "C:\Scripts\Dude Scripts\emailer.vbs" [Probe.Name] "[Device.Name]" [Service.Status] ([Service.ProblemDescription]) "[Device.FirstAddress]"
And this is the VB script; ' Authentication Constants
Const cdoAnonymous = 0 'Do Not Authenticate
Const cdoBasic = 1 'Basic (clear-text) Authentication
Const cdoNTLM = 2 'NTLM (NT Lan Manager Authentication)
' sendusing Constants
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).
' OpenTextFile Constants
Const ForReading = 1, ForWriting = 2, ForAppending = 8
LogYear = Year(Date)
LogMonth = Month(Date)
if Len(LogMonth) = 1 then LogMonth = "0" & LogMonth
LogDay = Day(Date)
if Len(LogDay) = 1 then LogDay = "0" & LogDay
ProbeName = WScript.Arguments.Item(0)
DeviceName = WScript.Arguments.Item(1)
ServiceStatus = WScript.Arguments.Item(2)
ProblemDescription = WScript.Arguments.Item(3)
IpAddress = WScript.Arguments.Item(4)
SendSubject = "Netmonitor Alert - " & DeviceName & " - " & ServiceStatus
SendBody = "Service " & ProbeName & " on " & DeviceName & " at " & IpAddress & " is now " & ServiceStatus & " - " & ProblemDescription
Set fso = CreateObject("Scripting.FileSystemObject")
LogFilename = LogYear & "-" & LogMonth & "-" & LogDay & " - Dude Alert Log.txt"
Set LogFile = fso.OpenTextFile(LogFilename,ForAppending,True)
LogFile.WriteLine(Now & " - " & SendBody)
LogFile.Close
Set fso = Nothing
smtpserver = "smtp.yourserver.com"
sendusername = "email@yourdomain.com"
sendpassword = "yourpassword"
smtpserverport = 995
MessageTo = "youremail@yourdomain.com"
call Mail
MessageTo = "yourphonenumber@txt.bellmobility.ca"
call Mail
WScript.Quit
sub Mail
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = SendSubject
objMessage.From = sendusername
objMessage.To = MessageTo
objMessage.TextBody = SendBody & Now
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = sendusername
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = sendpassword
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = smtpserverport
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
objMessage.Send
end sub
|
|
 bburley join:2010-04-30 Cold Lake, AB | I modified the above script before posting and the port 995 may not be compatible with "cdoBasic" authentication, but I am sure you can sort it out. |
|
 bburley join:2010-04-30 Cold Lake, AB | Here is another solution;
»forum.mikrotik.com/viewtopic.php?f=8&t=39220 |
|
 vipermCarpe DiemPremium join:2002-07-09 Winchester, CA | reply to bburley Cool I will try this later this weekend waiting for rain sto stop so I can hang my sector and backhaul on the tower.. |
|
 vipermCarpe DiemPremium join:2002-07-09 Winchester, CA | reply to bburley on your alert notice you start with c:\????
I am running on a rb433ah as a test for right now what would the alert look like running on that platform?
and is emailer.vbs the name you gave the script when you create it in mikrotik with winbox? -- »www.accelwireless.com ComTrain Certified Tower Climber. Wireless and IT consultant. Proficient in Mikrotik |
|
|
|
 bburley join:2010-04-30 Cold Lake, AB | .vbs is Visual Basic Script running on a Windows PC.
I am also running The Dude on a Windows PC.
You can create an email script in the MikroTik, but it will look very different.
You first have to set up "/tool e-mail" with some basic info. Server: [IP Address of mail server] Port: [Mail Server Port (25 or other)] From: [sender email address] User: [email user name - usually sender email address] Password: [users email password]
Then in the MikroTik script the line that sends the email looks like;
/tool e-mail send to=emailaddress@yourdomain.com subject="Email Alert" body="Text String" (or use $variable)
You can overide default e-mail tool settings by including "from=", "server=", and probably "port=" in the script line.
The MikroTik e-mail tool can handle basic authentication but I am not sure about SSL authentication.
From the MikroTik wiki: "Email tool uses only plain authentication and tls encryption. Other methods are not supported."
Offhand, I can't recall if there is an easy way of launching a PC-based script from the MikroTik, but I know you can create a PC-based script that will interact with a MikroTik Router. The PC-based script would have to periodically poll the router to see if there was something to do.
There is probably some clever way for a PC to become aware that the router wants to trigger an event, but I am not sure of the best approach.
"/tool fetch" might grab a web page from a local server that triggers based on the IP address(router) of the http request.
A telnet or ftp event might also be used. Perhaps an email from the MikroTik to a local mail server could trigger sending another ssl authenticated email from the local mail server.
The hard part is finding a *simple* way to do it. |
|
 bburley join:2010-04-30 Cold Lake, AB | I should mention that I have used "/tool e-mail" in a MikroTik Router to send an email directly to my cell phone.
Most carriers will allow email sent to [10digitPhoneNumber]@cellcarrier.com or similar. |
|
 bburley join:2010-04-30 Cold Lake, AB | You could also use this (or similar)
»www.postcastserver.com/ |
|
 | reply to viperm most common cell carrier email text setup is like this:
10number@vtext.com --- verizon @txt.att.com ----att @messaging.sprintpcs.com ---- sprint @tmomail.net --- Tmobile |
|
 | Don't forget the tower techs that use ghetropcs. 10digitnumber@mymetropcs.com
 |
|