View Single Post
  #1 (permalink)  
Old February 28th, 2005, 04:07 PM
savoym savoym is offline
Friend of Wrox
 
Join Date: Jun 2003
Posts: 119
Thanks: 0
Thanked 1 Time in 1 Post
Default How do I attach a file to an email in my .vbs file

I am using the following code to send an email in this .vbs file:

set objMail = WScript.CreateObject("CDo.Message")

objMail.configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/SendUsing") = 2 ' using cdosendusingport
objMail.configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Mail.mycompany.org"
objMail.configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/SMTPServerPort") = 25
objMail.configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/SMTPAuthenticate") = 0 'cdoAnonymous
objMail.configuration.Fields.Update

objMail.From = "[email protected]"

strMailBody = "This Email Created/Sent: " & Now() & vbcrlf & vbcrlf

objmail.Subject = "A DotNet Application Error(s) Text File Created on " & strServerName

'***** DEV - EMAIL. *****
objmail.To = "[email protected]"

strMailBody = strMailBody & "A DotNet Application Error(s) Text File has been created on " & strServerName & " in:" & vbcrlf & vbcrlf
strMailBody = strMailBody & "X:\inetpub\logfiles\dotneterrors" & strDate & ".txt" & vbcrlf & vbcrlf
objmail.textbody = strMailBody
objmail.Send

I need a way to attach the file that is in X:\inetpub\logfiles\dotneterrors.txt

Any direction or resource or help that anyone can provide would be appreciated. I've been looking this afternoon but to no avail.

Thank you.
Reply With Quote