Asp-Classic
經典 ASP 使用 SMTP 身份驗證發送電子郵件
我們從一家設計機構繼承了一個經典的 ASP 站點,該機構只是希望我們進行搜尋和替換以更改 SMTP 主機。沒問題,我們是一家 PHP 商店,但可以處理大多數事情。
進一步調查發現,我們需要對新的 SMTP 伺服器進行身份驗證。
一些Google搜尋使我們相信它正在使用 ASPMail 4,並且根據文件它不進行身份驗證。
http://www.serverobjects.com/comp/Aspmail4.htm
我們剛剛從這個電話中搜尋了“SMTPsvg.Mailer”:
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")我的假設是否正確,即以上是 ASPMail 4,並且 APSMAil 不進行身份驗證?
如果我需要替換 Aspmail,我可以使用什麼來通過 SMTP 伺服器進行身份驗證?
如前所述,使用 CDO。
set config = CreateObject("CDO.Configuration") sch = "http://schemas.microsoft.com/cdo/configuration/" with config.Fields .item(sch & "sendusing") = 2 ' cdoSendUsingPort .item(sch & "smtpserver") = application("smtpserver") .item(sch & "smtpserverport") = application("smtpserverport") .item(sch & "smtpauthenticate") = 1 'basic auth .item(sch & "sendusername") = application("sendusername") .item(sch & "sendpassword") = application("sendpassword") .update end with with CreateObject("CDO.Message") .configuration = config .to = ... .from = ... .subject = .... .HTMLBody = .... call .send() end with可以在此處找到有關配置對象的每個欄位的文件!