Read from file and display in email body



I would like this script to read from a text file and insert it into the body
of the email. This is what I have so far. Does anyone know how I can do
this?

'Set the global variables.
myName = "Tester"
mailFrom = "test1@xxxxxxxxx"
mailTo = "jtest@xxxxxxxx"
mailCC = "test@xxxxxxxx"
mailSubject = "Test"
HTMLBody ="<h1>Please review and reply to test2@xxxxxxxx with the
following:</h1><br>" & _
"1. Information in report has been reviewed and is accurate<br>" & _
"2. Information in report is not accurate and provide corrections<br><br>"
mailHost = "127.0.0.1"

Set objEmail = CreateObject("CDO.Message")

objEmail.From = myName & " <" & mailFrom & ">"
objEmail.To = mailTo
objEmail.CC = mailCC
objEmail.AddAttachment "c:\scripts\groupmembership2.txt"
objEmail.Subject = mailSubject
objEmail.HTMLBody = HTMLBody
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing";) = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver";) = _
MailHost
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport";) = 25
objEmail.Configuration.Fields.Update
objEmail.Send
.



Relevant Pages

  • Re: help emailing this script
    ... Set objEmail = CreateObject ... How do I add this to my script below and attatch the output? ... Dim objWMIService, objItem, colItems ... set objTextFile = objFSO.CreateTextFile ...
    (microsoft.public.scripting.vbscript)
  • Re: Script to Email attachment hangs on the AddAttachment statemen
    ... Your simple script hangs in the same place my script hangs in. ... Set objEmail = CreateObject ...
    (microsoft.public.scripting.vbscript)
  • Re: sending email through script
    ... Just not behind the firewall. ... Set objEmail = CreateObject ... How can I set it up to use my existing SMTP server, ... script that sends email? ...
    (microsoft.public.windows.server.scripting)
  • Help with Error Code 8004020C when script works
    ... What I don't understand is the script works and sends the email out to all ... Set objEmail = CreateObject ... objEmail.Subject = "VBScript send mail test" ... objEmail.Textbody = "VBScript Test to see if this will work." ...
    (microsoft.public.scripting.vbscript)
  • CDO Mail Importance flag....
    ... using a script. ... Set objEmail = CreateObject ... objEmail.Subject = "Server down" ...
    (microsoft.public.scripting.vbscript)