简体   繁体   English

经典ASP使用SMTP身份验证发送电子邮件

[英]Classic ASP sending email with SMTP Authentication

We have inherited a classic ASP site from a design agency who just wanted us to do a search and replace to change SMTP hosts. 我们从设计机构继承了一个经典的ASP网站,该网站只是希望我们进行搜索和替换以更改SMTP主机。 No problem, we are a PHP shop but can turn our hands to most things. 没问题,我们是PHP商店,但可以把手转向大多数事情。

On further investigation it was discovered that we need to authenticate with the new SMTP server. 在进一步调查中发现我们需要使用新的SMTP服务器进行身份验证。

A bit of googling lead us to believe that it is using ASPMail 4 and according to the docs it doesn't do authentication. 一些谷歌搜索引导我们相信它正在使用ASPMail 4并根据文档它不进行身份验证。

http://www.serverobjects.com/comp/Aspmail4.htm http://www.serverobjects.com/comp/Aspmail4.htm

We just googled "SMTPsvg.Mailer" from this call: 我们只是用这个电话搜索了“SMTPsvg.Mailer”:

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")

Am I correct in my assumptions that the above is ASPMail 4, and the APSMAil doesn't do authentication? 我在假设上面是ASPMail 4并且APSMAil不进行身份验证时是否正确?

What can I use to authenticate with a SMTP server if I need to replace Aspmail? 如果我需要替换Aspmail,我可以用什么来验证SMTP服务器?

As said, use CDO. 如上所述,使用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

Docs about each field of the config object can be found here ! 有关配置对象的每个字段的文档可以在这里找到!

Yes True. 没错。 Why don't you change to CDO? 你为什么不改用CDO? This article can be of some help. 这篇文章可以提供一些帮助。

How do I send e-mail with CDO? 如何使用CDO发送电子邮件?

Check if the hosting provider supports .Net Framework 2.0 (most do), if so rename the .asp file to .aspx, remove the code that sends the email and write some easy code: 检查托管服务提供商是否支持.Net Framework 2.0(大多数情况下),如果是这样,将.asp文件重命名为.aspx,删除发送电子邮件的代码并编写一些简单的代码:

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

Regards 问候

Thomas 托马斯

According to the docs here ASPMail 4.x just doesn't support authentication. 根据这里的文档ASPMail 4.x只是不支持身份验证。 It looks like you'll have to switch to a different COM-based SMTP component. 看起来您必须切换到不同的基于COM的SMTP组件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM