ASP中CDO.Message 怎么用

ASP中CDO.Message 怎么用,第1张

try

{

CDO.Message oMsg = new CDO.Message()

oMsg.From = ""//发送方邮箱

oMsg.To = ""//接收方邮箱

oMsg.Subject = ""//主题

oMsg.HTMLBody = ""//内容

CDO.IConfiguration iConfg = oMsg.Configuration

ADODB.Fields oFields = iConfg.Fields

oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"].Value=2

oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value=""//用户名

oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value=""//密码

oFields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"].Value=1

oFields["http://schemas.microsoft.com/cdo/configuration/languagecode"].Value=0x0804

oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value=""//邮件服务器

oFields.Update()

oMsg.BodyPart.Charset="gb2312"

oMsg.HTMLBodyPart.Charset="gb2312"

oMsg.Send()

oMsg = null

}

catch (Exception ex)

{

throw ex

}

Set objMail = Server.CreateObject("CDO.Message") Set objCDO = Server.CreateObject("CDO.Configuration") objCDO.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") =2objCDO.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")= "smtp.mxhichina.com" '邮件服务器,我这里用的是阿里云objCDO.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25objCDO.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10objCDO.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1objCDO.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "XXX@XXX.com"'发送邮件的邮箱地址objCDO.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "XXX"'密码objCDO.Fields.Update Set objMail.Configuration = objCDOobjMail.From = "XXX@XXX.com"''发件人,这里和上面的发送邮件地址保持一致objMail.Subject = "用户信息" ''标题objMail.To = "aaa@163.com"''收件人objMail.HtmlBody = "邮件正文内容"'发送内容。objMail.Send

CDO 应该是OE使用 邮件组件

不是JMAIL.

如果你用的JMAIL 这应该 =CreateObject("JMAIL.MESSAGE")

当然JMAIL记得注册下


欢迎分享,转载请注明来源:夏雨云

原文地址:https://www.xiayuyun.com/zonghe/56436.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-02-26
下一篇2023-02-26

发表评论

登录后才能评论

评论列表(0条)

    保存