asp发送邮件
站内发送邮件功能怎么实现啊?我用下面这些怎么实现不了呢?
Set CDO=Server.CreateObject("CDO.Message")
CDO.From = SiteConfig("SmtpServerMail")
CDO.To = MailAddRecipient
CDO.Subject = MailSubject
CDO.TextBody = MailBody
CDO.HTMLBodyPart.Charset="GB2312"
CDO.Send
Set CDO=Nothing
------解决方案--------------------可以考虑用jmail~这个组件没用过
------解决方案--------------------邮局服务器,账户名和密码都没设置,能发还真见鬼了。。下面是cdo发邮件的配置,修改红色部分
Sub AAA()
Const ns = "http://schemas.microsoft.com/cdo/configuration/"
Set cm = CreateObject("CDO.Message")
cm.from = "xxx@139.com"
With cm.configuration.Fields
.Item(ns & "sendusing") = 2
.Item(ns & "smtpserver") = "smtp.139.com"
.Item(ns & "smtpserverport") = 25
.Item(ns & "smtpauthenticate") = 1
.Item(ns & "sendusername") = "xxx"
.Item(ns & "sendpassword") = "yyy"
.Item(ns & "smtpconnectiontimeout") = 60
.Item(ns & "smtpusessl") = 0
.Update
End With
cm.To = "xxx@139.com"
cm.Subject = "标题:测试发邮件"
cm.Textbody = "正文:测试发邮件"
cm.Send
Set cm = Nothing
End Sub
------解决方案--------------------Set objMail = Server.CreateObject("CDO.Message")
Set objConfig = Server.CreateObject ("CDO.Configuration")
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="relay-hosting.secureserver.net"
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/languagecode") = "0x0804"
objConfig.Fields.Update()
Set objMail.Configuration = objConfig
objMail.Subject = m_subject
objMail.From =m_from
objMail.To = m_to
objMail.BodyPart.ContentTransferEncoding = "7bit"
'如果使用多國語言時,才要設定 Charset
objMail.BodyPart.Charset = "UTF-8"
objMail.HTMLBody =m_body
objMail.Send
Set objMail = Nothing
我以前用过,不过程序是放在外国主机上的,是可以正常发送的。
不过你要注意几个问题,这样发邮件方式会受到反垃圾邮件一些规则过滤,比如从外国主机发,国内邮箱是收不到,国内邮箱测试的时候,不用邮箱之间也会偶尔收不到,有的邮箱反垃圾邮件会拒绝这样的邮件。
------解决方案--------------------还在用Asp啊,赶紧升级成Asp.Net 吧。
------解决方案--------------------需要登录QQ邮箱 设置SMTP