2011-07-05 93 views
0

我很新的VBSCRIPT但這裏是我到目前爲止,似乎並沒有被工作雖:如何在ASP發送電子郵件到通訊組列表使用VBScript

<script type="text/vbscript"> 
Sub Senmail() 
Dim objOutlook As Object 
Dim objOutlookMsg As Object 
Set objOutlook = CreateObject("Outlook.Application") 
Set objOutlookMsg = objOutlook.CreateItem(0) 
With objOutlookMsg 
    .To = "[email protected]" 
    .Cc = "[email protected]" 
    .Subject = "Hello World (one more time)..." 
    .Body = "This is the body of message" 
    .HTMLBody = "HTML version of message" 
    .Send 
End With 
Set objOutlookMsg = Nothing 
Set objOutlook = Nothing 
End Sub 
</script> 

任何投入將不勝感激!或者任何其他方式,我可以發送電子郵件是我的asp ....

+0

你試過[CDO](http://stackoverflow.com/questions/4412129/how-to-create-group-email-with-cdo-使用-vb6/4433233#4433233)? – 2011-07-05 20:45:54

回答

0

下面是使用CDO/SMTP單程

Sub SendMail() 
    Set objMsg = CreateObject("CDO.Message") 
    Set objConfig = CreateObject("CDO.Configuration") 

    Set objFields = objConfig.Fields 
    With objFields 
     .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
     .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "YourSMTPServer" 
     .Update 
    End With 

    With objMsg 
     Set.Configuration = objConfig 
     .To = "[email protected]" 
     .CC = "[email protected]"  
     .From = "[email protected]" 
     .Subject = "Hello World" 
     .HTMLBody = "This is the body of message" 
     .Fields.Update 
     .Send 
    End with 

    Set objMsg = Nothing 
    Set objConfig = Nothing 
End Sub 
0

對於初學者,請從您的Dim聲明中刪除As Object。在VBScript中,你不能聲明變量As任何特定的數據類型。一切都是變體。

Dim objOutlook 
Dim objOutlookMsg 

如果你想要更多的幫助,那麼你可能想告訴我們具體談談您的問題不是什麼「似乎並沒有被工作」如你得到了什麼錯誤或錯誤的行爲。

相關問題