Link to home
Start Free TrialLog in
Avatar of nschwend
nschwend

asked on

mail dynamic ip

hello everybody,
I have a problem... my isp give me a dynamic IP which changes every 20 hours... I'm behind a router so with ipconfig I can only see my LAN address... I want to get an email everytime it changes, to permit me to access my PC from remote...

how can I do that? thank you a lot

Nick
Avatar of nschwend
nschwend

ASKER

they are really nice, but I have to schedule my vbs and none of them I can create or have a txt to use as message body...
Correct me if I am wrong but do you have any means of visual basic or must this be in script format?
it would be better if it's in script format because in not so good in programming...
arAddresses = GetIPAddresses()
msgbox ubound(arAddresses)+1 & " IP Address(es) found"
for each ip in arAddresses
  msgbox ip
next


Function GetIPAddresses()
'=====
' Returns array of IP Addresses as output
' by ipconfig or winipcfg...
'
' Win98/WinNT have ipconfig (Win95 doesn't)
' Win98/Win95 have winipcfg (WinNt doesn't)
'
' Note: The PPP Adapter (Dial Up Adapter) is
' excluded if not connected (IP address will be 0.0.0.0)
' and included if it is connected.
'=====
  set sh = createobject("wscript.shell")
  set fso = createobject("scripting.filesystemobject")

  Set Env = sh.Environment("PROCESS")
  if Env("OS") = "Windows_NT" then
    workfile = fso.gettempname
    sh.run "%comspec% /c ipconfig > " & workfile,0,true
  else
    'winipcfg in batch mode sends output to
    'filename winipcfg.out
    workfile = "winipcfg.out"
    sh.run "winipcfg /batch" ,0,true
  end if
  set sh = nothing
  set ts = fso.opentextfile(workfile)
  data = split(ts.readall,vbcrlf)
  ts.close
  set ts = nothing
  fso.deletefile workfile
  set fso = nothing
  arIPAddress = array()
  index = -1
  for n = 0 to ubound(data)
    if instr(data(n),"IP Address") then
      parts = split(data(n),":")
      if trim(parts(1)) <> "0.0.0.0" then
        index = index + 1
        ReDim Preserve arIPAddress(index)
        arIPAddress(index)= trim(cstr(parts(1)))
      end if
    end if
  next
  GetIPAddresses = arIPAddress
End Function
You could make your script run as a Scheduled Task to Execute the script every 10 minutes.

Example: Have 2 scripts 1 To execute to the script that gets the ip and sends the e-mail

Script 1: contains the ip address and sending the mail

Script2: simply executes script1,script 2 would be the filename place in a scheduled task.
Well maybe not every 10 minutes but every 20 hours and 10 minutes, I mean if you absolutley sure it changes every 20 hours on the dot each and every time, then you can just schedule the task for 20 hours and 10 minutes.
I would also suggest making sure you set the scheduled task almost immediatly after the ipchanges so it would be in sync with the changing of the ip address. every 20 hours
i tried your script but it gives me always 0 IP founds....

why it doesn't work?
hmm...Copy and paste all of it into a text file and save it as ip.vbs when u save it make sure you add "ip.vbs" to it so it saves it as  a .vbs file
'This is not very good but it works if you have an outlook express account
''''''''''

Try this


Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.AppActivate "explore"
    WshShell.Run "iexplore", 9
    Wscript.Sleep 6000
    WshShell.SendKeys "^o"
    Wscript.Sleep 1000
    WshShell.SendKeys "http://whatismyip.com"
    Wscript.Sleep 1000
    WshShell.SendKeys "{ENTER}"
    Wscript.Sleep 3000
    WshShell.SendKeys "^a"
    Wscript.Sleep 1000
    wshShell.SendKeys "%t"
    Wscript.Sleep 1000
    wshShell.SendKeys "{Right}"
    Wscript.Sleep 100
    wshShell.SendKeys "{Down}"
    Wscript.Sleep 100
    wshShell.SendKeys "{Down}"
    Wscript.Sleep 100
    wshShell.SendKeys "{Down}"
    Wscript.Sleep 100
    WshShell.SendKeys "{ENTER}"
    Wscript.Sleep 5000
    'Change for your email address *****
    WshShell.SendKeys "technicalsupport@glennsoftware.com"
    '***************************************
    '     ***
    Wscript.Sleep 1000
    WshShell.SendKeys "%s"
    wscript.sleep 4000
    'Send and ALT-F4 to Close the program
    WshShell.Sendkeys "%{F4}"
    Wscript.Quit
The problem is that I have Outlook 2003... I cannot use Outlook Express...
Did you try it?
I have no account in OE...

I know but it might work for outlook 2003, if you just try it see if it works.
no, nothing works... it gives me no error but I don't get any email.......
Well if you don't want to use a vbscript I already made a project that sends e-mail, I can easily add it to send the IP address, but this is for visual basic. I recommend using visual basic to do these tasks instead of vbscript.
for me it's important that I can schedule it and obtain my ip address... I don't care about language...

ASKER CERTIFIED SOLUTION
Avatar of nffvrxqgrcfqvvc
nffvrxqgrcfqvvc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
at the moment I cannot download the source... You are really kind... this evening I will download it... thank you again and again and again...

Nick
writing a program to do this is reinventing the wheel

go to www.dynu.com and get a free subdomain that points to your ip address.  It has a little service that you install that will send ip updates to their server and redirect accordingly.
MUCH EASIER than having to check your email every time!!!!!!!!!

i've been using it for years and rd would be a pain without it