Jmail 问题集锦

 

1、JMAIL的版本是多少?
JMAIL 是免费的4.0版本


2、JMAIL 需要单独的发信服务器吗?
JMAIL 需要设置单独的发信服务器
如:set mail=server.CreateObject("jmail.SMTPMail")
mail.ServerAddress = "mail.domain.com"


3、为什么使用jmail发信时发信失败?
最可能的原因是你指定的发信服务器需要发信认证,而你在程序中没有指定发信用户名和密码,具体的编码为:
set mail=CreateObject("jmail.Message")
mail.Charset ="gb2312"
mail.From ="from@hichina.com"
mail.AddRecipient "to@hichina.com"
mail.MailDomain="mail.hichina.com"
mail.MailServerUserName = " from @hichina.com"
mail.MailServerPassWord = "****"
mail.subject=”test”
mail.body= “欢迎”
'On Error Resume Next
mail.Send("mail.hichina.com")
mail.close()
set mail=nothing


4、Jmail 能发送附件吗?
可以
mail.AddAttachment (replace(server.MapPath("/test.doc"),"",""))


5、 Jmail 可以发送Html格式的邮件吗?
可以,具体看使用手册。


6、Jmail组件实例。
(1)发信服务器需要认证。
'以下的代码是发信服务器需要认证的,例如我们的邮箱服务器
<%
set mail=CreateObject("jmail.Message")
mail.Charset ="gb2312"
mail.From ="test@hichina.com"
mail.AddRecipient "test@hichina.com"
mail.MailDomain="mx.hichina.com"
mail.MailServerUserName = "test@hichina.com"
mail.MailServerPassWord = "*****"
mail.subject=Subject
mail.body= "hi china.com"
On Error Resume Next
mail.Send("mx.hichina.com")
mail.close()
set mail=nothing
response.write "发送成功"
%>
(2)发信服务器不需要认证。
'发信服务器不需要认证的
<%
set mail=server.CreateObject("jmail.SMTPMail")
mail.Charset="gb2312"
mail.ServerAddress = "mx.hichina.com"
mail.Sender="test@hichina.com"
mail.SenderName="test"
mail.AddRecipient("test@sina.com")
mail.Subject ="jmail邮件测试"
mail.body="jmail邮件测试."
mail.Priority="1"
'On Error Resume Next
mail.Execute()
mail.Close
Set mail=nothing
response.write "发送成功"
%>




二、Winhttp Post问题集锦

1、用Winhttp Pos组件Post的内容服务器无法收到结果?
需要在程序中加入如下代码:
http.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
具体例子为:
Err.Clear
On Error Resume Next
set http=server.CreateObject("WinHttp.WinHttpRequest.5.1")
http.SetTimeouts 30000,50000,30000,30000
http.Open "POST", "http://test.hichina.com/sms_gateway/sms_api", False
http.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
http.Send(sendStr)
If Err.Number = 0 Then 'POST成功
SendPwd=trim(http.responsetext)
else
SendPwd=-1
end if
http.Abort()

2、Pos组件返回的结果是乱码?
由于中文编码问题,如果返回的结果中含有中文,需要进行编码
vIn=http.responseBody
strReturn = ""
For q = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,q,1))
If ThisCharCode

 

 

 

 

 

如何用asp的jmail组件发邮件的应用

        前一段时间有发过一个简单的JMAIL邮件发邮件的代码,今天就把这个代码做一个具体的注解,并增加了另外两个格式的代码,并举几个简单的例子: 迪拜进出口贸易:uaedubaitrade.com
首先是jmail.smtpmail的核心代码:
<%
   Set jmail = Server.CreateObject("JMAIL.SMTPMail")    '创建一个JMAIL对象
   jmail.silent = true    'JMAIL不会抛出例外错误,返回的值为FALSE跟TRUE
   jmail.logging = true    '启用使用日志上海网页设计http://www.webopt.cn 
   jmail.Charset = "GB2312"   '邮件文字的代码为简体中文
   jmail.ContentType = "text/html"   '邮件的格式为HTML的
   jmail.ServerAddress = "Server Address"    '发送邮件的服务器
   jmail.AddRecipient Email     '邮件的收件人
   jmail.SenderName = "SenderName"     '邮件发送者的姓名
   jmail.Sender = "Email Address"     '邮件发送者的邮件地址
   jmail.Priority = 1    '邮件的紧急程序,1 为最快,5 为最慢, 3 为默认值
   jmail.Subject = "Mail Subject"   '邮件的标题
   jmail.Body = "Mail Body"    '邮件的内容 上海网站建设http://www.angshsh.cn
   jmail.AddRecipientBCC Email    '密件收件人的地址
   jmail.AddRecipientCC Email    '邮件抄送者的地址
   jmail.Execute()    '执行邮件发送
   jmail.Close     '关闭邮件对象 上海网站建设http://www.angshengsh.cn>
上海网页设计http://www.0gsj.cn
网站排名:http://www.shwzyh.cn
         w3Jmail4.3组件重新设计了其内部结构——使用Message对象代替原来的单一对象Jmail.smtpmail发送邮件,有些方法需要身份验证的(如163、yahoo等),可以用下面的方法解决:
<%
      Set jmail = Server.CreateObject("JMAIL.Message")    '建立发送邮件的对象
      jmail.silent = true     '屏蔽例外错误,返回FALSE跟TRUE两值
      jmail.logging = true    '启用邮件日志
      jmail.Charset = "GB2312"      '邮件的文字编码为国标
      jmail.ContentType = "text/html"     '邮件的格式为HTML格式
      jmail.AddRecipient Email      '邮件收件人的地址
      jmail.From = "Email From for Sender"    '发件人的E-MAIL地址
      jmail.MailServerUserName = "UserName of Email"      '登录邮件服务器所需的用户名
      jmail.MailServerPassword = "Password of Email"      '登录邮件服务器所需的密码
      jmail.Subject = "Mail Subject"     '邮件的标题 
      jmail.Body = "Mail Body"       '邮件的内容
      jmail.Prority = 1       '邮件的紧急程序,1 为最快,5 为最慢, 3 为默认值
      jmail.Send("Server Address")      '执行邮件发送(通过邮件服务器地址)
      jmail.Close()    '关闭对象 迪拜进出口贸易:uaedubaitrade.com
%>
     或
<%
     Set msg = Server.CreateObject("JMail.Message")
     msg.silent = true
     msg.Logging = true
     msg.Charset = "gb2312"
     msg.MailServerUserName = "..." '输入smtp服务器验证登陆名
     msg.MailServerPassword = "..." '输入smtp服务器验证密码
     msg.From = "...@...", 发件人email
     msg.FromName = FromName '发件人姓名
     msg.AddRecipient "...@...","...@..." '收件人email
     msg.Subject = "test" '主题
     msg.Body = "this is body!" '正文
     msg.Send ("smtp Server Name") 'smtp服务器地址
     Set msg = nothing
%>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值