繁体   English   中英

经典ASP中的CDOSYS电子邮件架构

[英]CDOSYS Email Schema in Classic ASP

我正在编写代码以通过CDOSYS发送电子邮件。 我必须在同一ASP页面的不同位置编写电子邮件发送代码。 我需要在每个代码中使用以下架构链接吗? 如果我在变量中声明它并尝试使用它不起作用并给出错误...我的经典ASP网站已部署在Windows Server 2012R2上( http://schemas.microsoft.com/cdo/configuration

mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = mailsite
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = websiteemail
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") =globalpassword

您可以像避免在其他任何地方重复执行代码一样避免重复执行代码:将需要重复执行的工作放在子例程中。

Sub EmailConfig(mailobj)
    mailobj.Configuration.Fields.Item("http://blahblahblah") = 1
    'etc.
End Sub

暂无
暂无

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

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