View Single Post
Old 04-17-2009, 05:06 PM   #6 (permalink)
office politics
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,425

office politics will become famous soon enough

Default Re: activeX email question

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."

office politics is offline