2012-09-06 95 views
0

我要發送電子郵件,對象不支持此屬性或方法CreateMHTMLBody

<% 
Set myMail=CreateObject("CDO.Message") 
myMail.Subject="Sending email with CDO" 
myMail.From="[email protected]" 
myMail.To="[email protected]" 
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" > 

回答

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  = "[email protected]" 
    .From = "[email protected]" 
    .Subject = "an example mhtml formatted message with attachment" 
    .AddAttachment "http://server.example.com" 
    .Send 
End With 

也看看這裏:http://www.paulsadowski.com/wsh/cdo.htm

我想你使用的方法的方式是錯誤的。

乾杯

+0

即使我使用AddAttachment,服務器也向我報告它不支持。那麼,我需要做什麼? – Ian

+0

@Ian請按照我在評論中提到的方式選擇此處:http://www.paulsadowski.com/wsh/cdo.htm – Rikki

相關問題