Advertisement
omegastripes

sendip2mail.vbs

May 9th, 2013
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. on error resume next
  2. ip = ""
  3. do
  4.     previp = ip
  5.     with createobject("Microsoft.XMLHttp")
  6.         ' http://v4.ipv6-test.com/api/myip.php
  7.        ' http://api.externalip.net/ip
  8.        .open "POST", "http://api.externalip.net/ip", false
  9.         .send("")
  10.         ip = .responsetext
  11.     end with
  12.     if err.number <> 0 then
  13.         err.clear
  14.         ip = ""
  15.     elseif previp <> ip then
  16.         with createobject("CDO.Message")
  17.             .subject = ""
  18.             .from = "<mailfrom>@mail.ru"
  19.             .to = "<mailto>@yandex.ru"
  20.             .textbody = ip
  21.             with .configuration.fields
  22.                 .item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  23.                 .item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.ru"
  24.                 .item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  25.                 .item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
  26.                 .item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "<mailfrom>@mail.ru"
  27.                 .item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "<password>"
  28.                 .update
  29.             end with
  30.             .send
  31.         end with
  32.     end if
  33.     wscript.sleep 60000
  34. loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement