deal all,
on my work we have to get some html pages from clients to register their machines for warranty.
i was browsing google and already got pretty far, having a vbs that did what we needed.
now the only thing is, we need a certain html that is on a linux server, but the internal ipadress is different for every linux machine.
so i would like to put up a window, that asks the cutomer to input his internal IP (ie 192.168.1.whatever) and then it should download the html in question and send it to us by mail.
i got it to work using not the ip but the network name, problem here is that not every linux box has the same name...
i'll post my findings here, hope you can help!
' Set your settings
strFileURL = " strHDLocation = "c:\the_actual_file.htm"
' Fetch the file
Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
objXMLHTTP.open "GET", strFileURL, false
objXMLHTTP.send()
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Open
objADOStream.Type = 1 'adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 'Set the stream position to the start
Set objFSO = Createobject("Scripting.FileSystemObject")
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "client@mail.com"
objEmail.To = "my@mail.com"
objEmail.Subject = "email subject"
objEmail.Textbody = "some text"
objEmail.AddAttachment "C:\the_actual_file.htm" 'NOTE: DO NOT USE AN "=" SIGN AFTER "AddAttachment"
objEmail.Configuration.Fields.Item _
(" = 2
objEmail.Configuration.Fields.Item _
(" = _
"smtp.gmail.com"
objEmail.Configuration.Fields.Item _
(" = 25
objEmail.Configuration.Fields.Update
objEmail.Send
my script is working, but the only variable is the IP adress wich should be entered by the customer.
another nice thing i would love to add is, that the customer would be able to also add his name into the mail that sends the html file
i hope you people can help out this noob
on my work we have to get some html pages from clients to register their machines for warranty.
i was browsing google and already got pretty far, having a vbs that did what we needed.
now the only thing is, we need a certain html that is on a linux server, but the internal ipadress is different for every linux machine.
so i would like to put up a window, that asks the cutomer to input his internal IP (ie 192.168.1.whatever) and then it should download the html in question and send it to us by mail.
i got it to work using not the ip but the network name, problem here is that not every linux box has the same name...
i'll post my findings here, hope you can help!
' Set your settings
strFileURL = " strHDLocation = "c:\the_actual_file.htm"
' Fetch the file
Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
objXMLHTTP.open "GET", strFileURL, false
objXMLHTTP.send()
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Open
objADOStream.Type = 1 'adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 'Set the stream position to the start
Set objFSO = Createobject("Scripting.FileSystemObject")
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "client@mail.com"
objEmail.To = "my@mail.com"
objEmail.Subject = "email subject"
objEmail.Textbody = "some text"
objEmail.AddAttachment "C:\the_actual_file.htm" 'NOTE: DO NOT USE AN "=" SIGN AFTER "AddAttachment"
objEmail.Configuration.Fields.Item _
(" = 2
objEmail.Configuration.Fields.Item _
(" = _
"smtp.gmail.com"
objEmail.Configuration.Fields.Item _
(" = 25
objEmail.Configuration.Fields.Update
objEmail.Send
my script is working, but the only variable is the IP adress wich should be entered by the customer.
another nice thing i would love to add is, that the customer would be able to also add his name into the mail that sends the html file
i hope you people can help out this noob