just wrote this script to email out Sims learning gateway logins

Requires a mail server with SMTP


1. csv file containing data
Ours has the columns
fullname, surname, salutation, email, slg username, slg password

2. the letter template in a txt file e.g.

Dear #salutation #surname,

Here are the details for Sims Learning Gateway. 

username: #username
password: #password

You will be asked to create a new password on your first logon


Network Manager

the script code is as follows.

   Const ForReading = 1, ForWriting = 2
   Dim fso, f
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.OpenTextFile("data.csv", ForReading)
   set letter = fso.OpenTextFile("letter.txt", forreading)

'replace function   
Function ReplaceTest(str1, patrn, replStr)
  Set regEx = New RegExp            ' Create regular expression.
  regEx.Pattern = patrn            ' Set pattern.
  regEx.IgnoreCase = True            ' Make case insensitive.
  ReplaceTest = regEx.Replace(str1, replStr)   ' Make replacement.
End Function

set t = fso.OpenTextFile("letter.txt", ForReading)

  Do While f.AtEndOfStream <> True
      xrow = f.readline
	  'wscript.echo xrow
	  xrowarray = split(xrow,",")
	  salutation = xrowarray(2)
	  surname = xrowarray(1)
	  email = xrowarray(3)
	  username = xrowarray(4)
	  password = xrowarray(5)
thismessage = ""
thismessage = basestring
thismessage = replacetest(thismessage, "#salutation", salutation)
thismessage = replacetest(thismessage, "#surname", surname)
thismessage = replacetest(thismessage, "#username", username)
thismessage = replacetest(thismessage, "#password", password)

set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = "SLG Your user details"
'objMessage.Sender = "slg@ldomain"
objMessage.from = "Sims Learning Gateway Admin <slg@domain>" 
objMessage.To = email
objMessage.TextBody = thismessage

objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="<ip of mail server>"
'Server port
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 

set objmessage=nothing

	  wscript.sleep 500