On Mar 4, 7:33*pm, Drummer_Geek <Drummer_G...@newsgroup> wrote:
> I am trying to use CDO in VBScript to send email from one server to a
> separate exchange server. *The article athttp://support.microsoft.com/kb/171440/states that CDOSYS version 6 library
> is obtained "through installation" of Windows 2003 but alas, email does not
> work and I am unable to locate the CDOSYS.dll on my Windows 2003 system.
>
> I have tried configuring SMTP with Control Panel -> Add or Remove Programs
> -> Add/Remove Windows Components -> Application Server -> Internet
> Information Services (IIS) -> *SMTP Service) but that didn't give me the
> CDOSYS.dll or CDO functionality either.
>
> What "installation" feature do I need to install/configure, to get this
> functionality?
>
> --
> It''s my flaws that keep me humble Here is how I do it:
'<------------Begin----------------------------------------------->
adminmail = "somebody@newsgroup"
'
smtp = "mail_server name or IP"
Set mailing = CreateObject("CDO.Message")
Set wshNet = CreateObject("WScript.Network")
mailing.From = ("fromSomeone@newsgroup")
mailing.To = adminmail
mailing.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/
configuration/sendusing") = 2
mailing.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/
configuration/smtpserver") = smtp
mailing.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/
configuration/smtpserverport") = 25
mailing.Subject = header & "Data Transfer Success logs"
sFullProductionMessage = "See attached file..." & vbcrlf
mailing.TextBody = sFullProductionMessage
mailing.Configuration.Fields.Update
mailing.AddAttachment "R:\dailylog.txt"
mailing.Send
On Error Goto 0
'<---------------------------- END -----------------------------------
What if you wanted the Attachment to be the body text?
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
'Open the file for reading
Set f = fso.OpenTextFile("C:\SendLogs\dailylog.txt", ForReading)
'The ReadAll method reads the entire file into the variable BodyText
BodyText = f.ReadAll
'Close the file
f.Close
Set f = Nothing
Set fso = Nothing
And in your message function or sub or whatever;
mailing.TextBody = BodyText
How about CC?
mailing.Cc = "someoneelse@newsgroup"