Object不支持此属性或方法CreateMHTMLBody

时间:2012-09-06 12:02:16

标签: html email asp-classic

我打算发一封电子邮件,

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydomain.com"
myMail.To="someone@somedomain.com"
myMail.CreateMHTMLBody "http://www.w3schools.com/asp/"
myMail.Send
set myMail=nothing
%>

如上所述,网页会返回错误

  

Microsoft VBScript运行时错误'800a01b6'对象不支持

     

此属性或方法:'CreateMHTMLBody'

那么,如何发送包含html和图片的电子邮件, 喜欢

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >

1 个答案:

答案 0 :(得分:0)

请点击此处MSDN

' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Dim iMsg  as New CDO.Message
Dim iConf as New CDO.Configuration
Dim Flds  as ADODB.Fields
Set Flds = iConf.Fields
Flds(cdoURLProxyServer)      = "myserver:80"
Flds(cdoURLProxyBypass)      = "<local>"
Flds(cdoURLGetLatestVersion) = True
Flds.Update

With iMsg
   Set .Configuration = iConf
   ' IMPORTANT: Storing user names and passwords inside source code
   ' can lead to security vulnerabilities in your software. Do not
   ' store user names and passwords in your production code.
   .CreateMHTMLBody "http://InternalNTLMAuthRequiredServer", _
                    "domain\username", _
                    "password"
   .To      = "example2@example.com"
   .From    = "example@example.com"
   .Subject = "an example mhtml formatted message with attachment"
   .AddAttachment "http://server.example.com"
   .Send
End With

另请参阅此处:http://www.paulsadowski.com/wsh/cdo.htm

我认为你使用这种方法的方式是错误的。

干杯