WINDOWS2000 SCRIPT PROBLEM

J

JVAUGHAN

I'm trying to create a script to send an email with an
attachment. Here's the script;

Set objEmail = CreateObject("CDO.Message")
objEmail.From = "(e-mail address removed)"
objEmail.To = "(e-mail address removed)"
objEmail.Subject = "Monthly File Transfer"
objEmail.Textbody = "Here is your monthly file."
objEmail.AddAttachment = "monthlyfile.zip"
objEmail.Send


The addattachment line doesn't work. Everything else
does. I get an error message "Object doesn't support this
property or method" when I uncomment the add attachment
line. Any ideas?
 
D

Daniel Chang [MSFT]

JVaughan,

Try microsoft.public.dotnet.scripting or some of the other scripting
newgroups. Or check out the MSDN website for more sample scripts. I'm not
sure if the CDO.Message object exposes the fields you've referred to -- try
the other group and you may have better success.

Dim iMsg
Set iMsg = CreateObject("CDO.Message")
Dim iConf
Set iConf = CreateObject("CDO.Configuration")

Dim Flds
Set Flds = iConf.Fields

With Flds
' assume constants are defined within script file
.Item(cdoSendUsingMethod) = 2 ' cdoSendUsingPort
.Item(cdoSMTPServerName) = "(e-mail address removed)"
.Item(cdoSMTPConnectionTimeout) = 10 ' quick timeout
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = "username"
.Item(cdoSendPassword) = "password"
.Item(cdoURLProxyServer) = "server:80"
.Item(cdoURLProxyBypass) = "<local>"
.Item(cdoURLGetLatestVersion) = True
.Update
End With

With iMsg
Set .Configuration = iConf
.To = """User A"" <[email protected]>"
.From = """User B"" <[email protected]>"
.Subject = "Hows it going? I've attached my web page"
.CreateMHTMLBody "http://mypage"
.AddAttachment "C:\files\mybook.doc"
.Send
End With

--
--
Daniel Chang
Server Setup Team

Search our Knowledge Base at http://support.microsoft.com/directory
Visit the Windows 2000 Homepage at
http://www.microsoft.com/windows2000/default.asp
See the Windows NT Homepage at http://www.microsoft.com/ntserver/

NOTE: Please reply to the newsgroup and not directly to me. This allows
others to add to and benefit from these threads and also helps to ensure a
more timely response. Thank you!
This posting is provided "AS IS" without warranty either expressed or
implied, including, but not limited to, the implied warranties of
merchantability or fitness for a particular purpose.
The views and opinions expressed in this newsgroup posting are mine and do
not necessarily express or reflect the views and / or opinions of Microsoft.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top