activeX email question

Status
Not open for further replies.

benny237

Solid State Member
Messages
20
I would like to write an activeX script for a button . . .

when the user presses that button it automatically sends an email to a specified email address. . .the user does not have to press anything except for the web button . . .

var ax = new ActiveXObject("WScript.Network");
document.write("Username: ");
document.write(ax.UserName + '<br />');
document.write("Computer Name: ");
document.write(ax.ComputerName + '<br />');
document.write("Domain Name: ");
document.write(ax.UserDomain + '<br />');


above is code I am using to extrapolate the username and computername . . .

what I still would like to do . . .



is there anyway to get the ip address of the computer??

also, how would I send all of this data in an email to the helpdesk mailbox??

PLEASE, any help is greatly appreciated!!
 
no help from that one office politics . . .

I am using an activex script right now that gives user name, domain, and computer name. . .

what would I add to it to give ip address, and also email that information to a specified source?

var ax = new ActiveXObject("WScript.Network");
document.write("Username: ");
document.write(ax.UserName + '<br />');
document.write("Computer Name: ");
document.write(ax.ComputerName + '<br />');
document.write("Domain Name: ");
document.write(ax.UserDomain + '<br />');
 
actually what you're doing is creating a wshnetwork object in javascript code and showing properties of that object to the user.

WSH » Objects » wshnetwork - DevGuru Quick Reference

ActiveXObject Object



you really want to use server side code to complete this task because the server will always show the public ip given by the isp as opposed to the private ip given by the home router or set by the user.
 
office politics -

the data that I have all ready generated is exactly what I need . . . now the question is, whether I can automatically send these three lines of data in an email . . .

any idea how to do this?
 
here's some code for 2000/xp. vista hasn't been tested.

you need to change the smtp server and email addresses

it's vbscript.



Code:
Set objEmail = CreateObject("CDO.Message")

objEmail.From = "from@email.com"
objEmail.To = "to@email.com"

objEmail.Subject = "subject text" 



ax = createObject("WScript.Network");
txt = "Username: ")
txt = txt & ax.UserName & "<br />"
txt = txt & "Computer Name: "
txt = txt & ax.ComputerName & '<br />"
txt = txt & "Domain Name: "
txt = txt & ax.UserDomain & '<br />"



objEmail.htmlbody = txt
                    

objEmail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
        "smtp.server.com" 
objEmail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update

'for each i in list

  'msgbox i

  'objEmail.AddAttachment i

'next

'objEmail.AddAttachment wshshell.currentdirectory & "\" & logf

objEmail.Send
  
  'msgbox "sent."
 
Status
Not open for further replies.
Back
Top Bottom