代码如下:
<%
On Error Resume Next
Dim JMail
Set JMail=Server.CreateObject("JMail.Message")
If JMail Is Nothing Then
Response.Write "不支持"
Else
Response.Write "支持"
End If
%>
2、访问这个保存的页面,即可查看空间是否支持了。
3、测试Jmail邮件发送是否正常。下载附件解压后修改jmail.asp相关配置参数,后上传到网站目录直接访问即可。
1.安装jmail 2.找到jmail.dll 3.tlbimp.exe jmail.dll /out:myJmail.dll /namespace:myJmail 4.添加对jmail.dll的引用。5.运行安装程序6.把jmail.dll复制到项目bin目录下面 7.代码: http://hi.baidu.com/dxit/blog/item/ba894b82a9aae5a30cf4d2bf.htmlASP用JMail发送邮件--解释代码2006年10月26日nbsp星期四nbsp18:04首先是jmail.smtpmail的核心代码:nbspamplt%nbspSetnbspjmailnbsp=nbspServer.CreateObject(“JMAIL.SMTPMail“)nbsp‘创建一个JMAIL对象nbspjmail.silentnbsp=nbsptruenbsp‘JMAIL不会抛出例外错误,返回的值为FALSE跟TRUEnbspjmail.loggingnbsp=nbsptruenbsp‘启用使用日志nbspjmail.Charsetnbsp=nbsp“GB2312“nbsp‘邮件文字的代码为简体中文nbspjmail.ContentTypenbsp=nbsp“text/html“nbsp‘邮件的格式为HTML的nbspjmail.ServerAddressnbsp=nbsp“ServernbspAddress“nbsp‘发送邮件的服务器nbspjmail.AddRecipientnbspEmailnbsp‘邮件的收件人nbspjmail.SenderNamenbsp=nbsp“SenderName“nbsp‘邮件发送者的姓名nbspjmail.Sendernbsp=nbsp“EmailnbspAddress“nbsp‘邮件发送者的邮件地址nbspjmail.Prioritynbsp=nbsp1nbsp‘邮件的紧急程序,1nbsp为最快,5nbsp为最慢,nbsp3nbsp为默认值nbspjmail.Subjectnbsp=nbsp“MailnbspSubject“nbsp‘邮件的标题nbspjmail.Bodynbsp=nbsp“MailnbspBody“nbsp‘邮件的内容nbspjmail.AddRecipientBCCnbspEmailnbsp‘密件收件人的地址nbspjmail.AddRecipientCCnbspEmailnbsp‘邮件抄送者的地址nbspjmail.Execute()nbsp‘执行邮件发送nbspjmail.Closenbsp‘关闭邮件对象nbsp%ampgtnbspw3nbspJmail4.3组件重新设计了其内部结构——使用Message对象代替原来的单一对象Jmail.smtpmail发送邮件,有些方法需要身份验证的(如163、yahoo等),可以用下面的方法解决:nbspamplt%nbspSetnbspjmailnbsp=nbspServer.CreateObject(“JMAIL.Message“)nbsp‘建立发送邮件的对象nbspjmail.silentnbsp=nbsptruenbsp‘屏蔽例外错误,返回FALSE跟TRUE两值jnbspmail.loggingnbsp=nbsptruenbsp‘启用邮件日志nbspjmail.Charsetnbsp=nbsp“GB2312“nbsp‘邮件的文字编码为国标nbspjmail.ContentTypenbsp=nbsp“text/html“nbsp‘邮件的格式为HTML格式nbspjmail.AddRecipientnbspEmailnbsp‘邮件收件人的地址nbspjmail.Fromnbsp=nbsp“EmailnbspFromnbspfornbspSender“nbsp‘发件人的E-MAIL地址nbspjmail.MailServerUserNamenbsp=nbsp“UserNamenbspofnbspEmail“nbsp‘登录邮件服务器所需的用户名nbspjmail.MailServerPasswordnbsp=nbsp“PasswordnbspofnbspEmail“nbsp‘登录邮件服务器所需的密码nbspjmail.Subjectnbsp=nbsp“MailnbspSubject“nbsp‘邮件的标题nbspjmail.Bodynbsp=nbsp“MailnbspBody“nbsp‘邮件的内容nbspjmail.Proritynbsp=nbsp1nbsp‘邮件的紧急程序,1nbsp为最快,5nbsp为最慢,nbsp3nbsp为默认值nbspjmail.Send(“ServernbspAddress“)nbsp‘执行邮件发送(通过邮件服务器地址)nbspjmail.Close()nbsp‘关闭对象nbsp%ampgtnbsp我们写程序,一般情况下都是说要代码模块化,这样方便维护,同时也方便移植。因此,我在这里将这个发邮件的写成一个子程,在调用的时候可以直接调用(当然,如果你高兴写成函数的话也是可以的,这个主要是看个人兴趣):nbspamplt%nbsp‘参数说明nbsp‘Subjectnbsp:nbsp邮件标题nbsp‘MailAddressnbsp:nbsp发件服务器的地址,如smtp.163.comnbsp‘Emailnbsp:nbsp收件人邮件地址nbsp‘Sendernbsp:nbsp发件人姓名nbsp‘Contentnbsp:nbsp邮件内容nbsp‘Fromernbsp:nbsp发件人的邮件地址nbspSubnbspSendAction(subject,nbspmailaddress,nbspemail,nbspsender,nbspcontent,nbspfromer)nbspSetnbspjmailnbsp=nbspSer 查看原帖>>欢迎分享,转载请注明来源:夏雨云
评论列表(0条)