Re: how to output a file and send as email

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



How wrote:
Hello,

I have a vb script that send out email with attached a file as below.
So right now i would like to output the file in the mail content rather then
attached a file.

Any precious advice?

Set objEmail = CreateObject("CDO.Message")

objEmail.From = " "
objEmail.To = " "
objEmail.Subject = "Test"
objEmail.Textbody = "Test"
objEmail.AddAttachment "c:\attachment"

objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing";) = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver";) = _
"ip address"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport";) = 25
objEmail.Configuration.Fields.Update

objEmail.Send



I am assuming that you're referring to a text file, which you'd like to
insert into the body of an e-mail? If so, you can use the
Scripting.FileSystemObject to read the text from the file and assign it
to the body of the e-mail message. See the OpenTextFile method in this link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/af4423b2-4ee8-41d6-a704-49926cd4d2e8.asp

Trevor Sullivan
MCP
.



Relevant Pages

  • Re: Script Error
    ... BobW wrote: ... an e-mail message I get the following error message and printing fails ... Internet Explorer Script Error ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: [PHP] variable substitution
    ... I have two variables declared in the global scope of a script. ... One is a string with a reference for substitution to the other ... intended to be an e-mail message body ->!SPAM. ...
    (php.general)
  • Re: Load Testing Script
    ... Right now I just have a script that does inserts and selects. ... Are you going from Oracle to Oracle? ... This E-mail message is for the sole use of the intended recipientand ...
    (perl.dbi.users)
  • Re: Script Error
    ... an e-mail message I get the following error message and printing fails ... running scripts on this page". ... Internet Explorer Script Error ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)