簡體   English   中英

經典ASP使用SMTP身份驗證發送電子郵件

[英]Classic ASP sending email with SMTP Authentication

我們從設計機構繼承了一個經典的ASP網站,該網站只是希望我們進行搜索和替換以更改SMTP主機。 沒問題,我們是PHP商店,但可以把手轉向大多數事情。

在進一步調查中發現我們需要使用新的SMTP服務器進行身份驗證。

一些谷歌搜索引導我們相信它正在使用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

有關配置對象的每個字段的文檔可以在這里找到!

沒錯。 你為什么不改用CDO? 這篇文章可以提供一些幫助。

如何使用CDO發送電子郵件?

檢查托管服務提供商是否支持.Net Framework 2.0(大多數情況下),如果是這樣,將.asp文件重命名為.aspx,刪除發送電子郵件的代碼並編寫一些簡單的代碼:

http://www.systemwebmail.com/faq/3.8.aspx

問候

托馬斯

根據這里的文檔ASPMail 4.x只是不支持身份驗證。 看起來您必須切換到不同的基於COM的SMTP組件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM