MSFN Forum: Print array values in email body in vbscript - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Print array values in email body in vbscript Rate Topic: -----

#1 User is offline   Veeravicky22 

  • Group: Members
  • Posts: 1
  • Joined: 08-February 13
  • OS:none specified
  • Country: Country Flag

Posted 08 February 2013 - 07:47 AM

Hi ,

I have a list of values in an array. I want to print each value from the array in a new line in the email body. Please find below the code for the mail body. Please help me on how to display the each value in a new line in the mail body.
Set objFSO = CreateObject("Scripting.FileSystemObject") 

Dim objFSO, objFolder, colFiles
Set objFile = objFSO.OpenTextFile("C:\Deployment\Deploy_Group_Deploy\Input.txt", ForReading) 
 
Const ForReading = 1 
 
Dim arrFileLines() 
i = 0 
Do Until objFile.AtEndOfStream 
Redim Preserve arrFileLines(i) 
arrFileLines(i) = objFile.ReadLine 
i = i + 1 
Loop 
objFile.Close 

Set objEmail = CreateObject("CDO.Message")
ObjEmail.From = "xxxx@xxx.com"
objEmail.To = "xxxx@xxx.com"
objEmail.Subject = "Informatica Deployment Completion" 
Set objEmail.Textbody = 
<THIS IS WHERE I NEED TO PRINT THE ARRAY VALUES>
				
							
														
		    		
objEmail.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _ 
"xxxxx"
 
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send


Gsm added code tags
Thanks,
Veera


#2 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,351
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 08 February 2013 - 12:25 PM

Make these changes to your script and see if that works

Dim EmailTxt

 Do Until objFile.AtEndOfStream
  EmailTxt= EmailTxt & vbCrLf & objFile.ReadLine 
 Loop 
objFile.Close 




Set objEmail.Textbody = EmailTxt


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy