3DWatch > 3DWatch (English)

Is It Possible to Email on IP Change

(1/1)

Silber:
When my IP changes, I need to update some things other than the DNS record. Is there a way to get an email when 3DWatch sees that the IP changed? If not in the program, is there any other software that can work with 3D to do that?

Thanks.

Thomas:
Hi Silber,

You could use the 'Application Launch' feature to run a script that does what you want. There is a VB script example at the end of this message (filename SendMail.vbs).

Thomas

--- Code: ---'--------------------------------------------------
'
' Sends email from the local SMTP service using CDONTS objects
'
' Usage:
'   sendmail -t <to> -f <from> -s "<subject>" -b "<message>"
'   sendmail [-help|-?]
'
'--------------------------------------------------

Option Explicit
On Error Resume Next

Dim objSendMail, oArgs, ArgNum
Dim strTo, strFrom, strSubject, strBody

Set oArgs = WScript.Arguments
ArgNum = 0

While ArgNum < oArgs.Count
  Select Case LCase(oArgs(ArgNum))
Case "-to","-t":
ArgNum = ArgNum + 1
strTo = oArgs(ArgNum)
Case "-from","-f":
ArgNum = ArgNum + 1
strFrom = oArgs(ArgNum)
Case "-subject","-s":
ArgNum = ArgNum + 1
strSubject = oArgs(ArgNum)
Case "-body","-b":
ArgNum = ArgNum + 1
strBody = oArgs(ArgNum)
Case "-help","-?":
Call DisplayUsage
Case Else:
Call DisplayUsage
  End Select
  ArgNum = ArgNum + 1
Wend

If oArgs.Count=0 Or strTo="" Or strFrom="" Or _
strSubject="" Or strBody="" Then
  Call DisplayUsage
Else
  Set objSendMail = CreateObject("CDONTS.NewMail")
objSendMail.From = strFrom
objSendMail.To = strTo
objSendMail.Subject = strSubject
objSendMail.Body = strBody
objSendMail.Send
  Set objSendMail = Nothing
End If

' Display the usage for this script
Sub DisplayUsage
  WScript.Echo "Usage:" & Chr(10) & _
"  sendmail -t <to address> -f <from address> -s " & _
Chr(34) & "<subject>" & Chr(34) & " -b " & Chr(34) & _
"<message body>" & Chr(34) & Chr(10) & _
"  sendmail [-help|-?]"
  WSCript.Quit
End Sub

--- Ende Code ---

Silber:
Thanks for the script. That should do the job.

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln