Hello ALL,
I am tring to create a way for users to send an email to our helpdesk with out using an email client. The Result is the email gets sent to the helpdesk, Picks up there IP, MAC address and usernamer and creates a workorder and emails them back. What my script does is takes the username of the user logged in and replys to it.
However I have some users that do not have the same username and email address. Is there a variable i can set to retrieve an email address from LDAP. I have tried mail but i getting an error. Script is below. I wish i could just change them to be the same...But lets just say thats not possible. My line in question is
objEmail.From = WshNetwork.UserName & "@mydomain.com"
ie...
Username = John.doe
Email = john.doe1@mydomain.com
___________________________________________________________
<head>
<title>HelpDesk</title>
<HTA:APPLICATION
APPLICATIONNAME="HelpDesk"
SCROLL="yes"
SINGLEINSTANCE="yes"
>
</head>
<script language="VBScript">
'__________________________________________________________phone_____________________________________________
Sub ticket
Set objEmail = CreateObject("CDO.Message")
Set FileSystem = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
Set WshNetwork = CreateObject("WScript.Network")
'Input BOx.
strAnswer = window.prompt ("PLEASE EXPLAIN WHAT YOUR PROBLEM IS BELOW")
'Email Heading
objEmail.From = WshNetwork.UserName & "@mydomain.com"
objEmail.To = "helpdesk@mydomain.com"
objEmail.Subject = "Automated Ticket from the Public folder"
'Collectiong Info
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colAdapters = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
n = 1
For Each objAdapter in colAdapters
If Not IsNull(objAdapter.IPAddress) Then
For i = 0 To UBound(objAdapter.IPAddress)
objEmail.Textbody = strAnswer & " Physical (MAC) address: " & objAdapter.MACAddress & " IP address: " & objAdapter.IPAddress(i) & " Host name:" & objAdapter.DNSHostName
Next
End If
Next
'Email Server Config
objEmail.Configuration.Fields.Item _
(" = 2
objEmail.Configuration.Fields.Item _
(" = _
"Myserver"
objEmail.Configuration.Fields.Item _
(" = 25
objEmail.Configuration.Fields.Update
objEmail.Send
msgbox "Your work order has been Sent. If you need anything further please Call Extension. An email has been sent to your account with the work order number."
End Sub
'___________________________________________________________________________________________________________________________
</script>
</script>
<body background = "wp2.jpg">
<body>
<font color="blue" face="Times New Roman" size="4"><center>*Please click below to open a ticket with the HelpDesk*</center></font>
<p>
<p><center>
<input type="button" value=" Open a Ticket " name="run_buttonticket" onClick="ticket"></center>
<p><center>
</body>
I am tring to create a way for users to send an email to our helpdesk with out using an email client. The Result is the email gets sent to the helpdesk, Picks up there IP, MAC address and usernamer and creates a workorder and emails them back. What my script does is takes the username of the user logged in and replys to it.
However I have some users that do not have the same username and email address. Is there a variable i can set to retrieve an email address from LDAP. I have tried mail but i getting an error. Script is below. I wish i could just change them to be the same...But lets just say thats not possible. My line in question is
objEmail.From = WshNetwork.UserName & "@mydomain.com"
ie...
Username = John.doe
Email = john.doe1@mydomain.com
___________________________________________________________
<head>
<title>HelpDesk</title>
<HTA:APPLICATION
APPLICATIONNAME="HelpDesk"
SCROLL="yes"
SINGLEINSTANCE="yes"
>
</head>
<script language="VBScript">
'__________________________________________________________phone_____________________________________________
Sub ticket
Set objEmail = CreateObject("CDO.Message")
Set FileSystem = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
Set WshNetwork = CreateObject("WScript.Network")
'Input BOx.
strAnswer = window.prompt ("PLEASE EXPLAIN WHAT YOUR PROBLEM IS BELOW")
'Email Heading
objEmail.From = WshNetwork.UserName & "@mydomain.com"
objEmail.To = "helpdesk@mydomain.com"
objEmail.Subject = "Automated Ticket from the Public folder"
'Collectiong Info
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colAdapters = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
n = 1
For Each objAdapter in colAdapters
If Not IsNull(objAdapter.IPAddress) Then
For i = 0 To UBound(objAdapter.IPAddress)
objEmail.Textbody = strAnswer & " Physical (MAC) address: " & objAdapter.MACAddress & " IP address: " & objAdapter.IPAddress(i) & " Host name:" & objAdapter.DNSHostName
Next
End If
Next
'Email Server Config
objEmail.Configuration.Fields.Item _
(" = 2
objEmail.Configuration.Fields.Item _
(" = _
"Myserver"
objEmail.Configuration.Fields.Item _
(" = 25
objEmail.Configuration.Fields.Update
objEmail.Send
msgbox "Your work order has been Sent. If you need anything further please Call Extension. An email has been sent to your account with the work order number."
End Sub
'___________________________________________________________________________________________________________________________
</script>
</script>
<body background = "wp2.jpg">
<body>
<font color="blue" face="Times New Roman" size="4"><center>*Please click below to open a ticket with the HelpDesk*</center></font>
<p>
<p><center>
<input type="button" value=" Open a Ticket " name="run_buttonticket" onClick="ticket"></center>
<p><center>
</body>