Re: Read from file and display in email body
- From: "Jan" <bril@xxxxx>
- Date: Tue, 14 Jun 2005 11:23:12 +0200
Try this:
Const ForReading = 1, ForWriting = 2
File="C:\AUTOEXEC.BAT"
Set Fso = CreateObject("Scripting.FileSystemObject")
Set F = Fso.OpenTextFile(File, ForReading)
objEMail.TextBody = F.ReadAll
F.Close
"modemgeek" <modemgeek@xxxxxxxxxxxxxxxxxxxxxxxxx> schreef in bericht
news:443B69D5-E98B-4595-ABB8-6536BE227CBF@xxxxxxxxxxxxxxxx
>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
.
- References:
- Read from file and display in email body
- From: modemgeek
- Read from file and display in email body
- Prev by Date: Ping = IP addresses
- Next by Date: Re: .VBS script help (simple?)
- Previous by thread: Read from file and display in email body
- Next by thread: Logoff user!
- Index(es):
Relevant Pages
|