用Jmail写ASP发送邮件,常见问题解答。

 1   
 2Set JMail=Server.CreateObject("JMail.Message")   
 3JMail.Logging=True   
 4JMail.Charset="gb2312"   
 5Jmail.MailServerUserName="gzoffice"   
 6Jmail.MailServerPassWord="111111"   
 7JMail.ContentType = "text/html"   
 8JMail.From ="[email protected]"   
 9JMail.FromName="lsq"   
10JMail.Subject="试试"   
11JMail.Body="aaaaaaaaaaaaffffffffffffffffaddddddddddeeeeeeeeee"   
12JMail.AddRecipient "[email protected]"   
13JMail.Priority=3   
14Jmail.Send "mail.gzmaplesoft.com"   
15Set JMail=nothing   

(用户密码未用真实密码)
为简单起见,没加入JMail.Silent=true和错误收集代码。
但运行时总是在send处出错。请指教!(从速)谢谢各位!
---------------------------------------------------------------

我认为这是因为你的发件服务器要求身份验证造成的。对于你用的邮件服务器
mail.gzmaplesoft.com。

应该是共享的企业邮局,

所以,
Jmail.MailServerUserName="gzoffice"
这一句不对,应该使用

Jmail.MailServerUserName="[email protected]"

,同时,建议加上

JMail.Silent = True
---------------------------------------------------------------

jmial4.3版

 1   
 2dim email,title,msg,smtpserver,smtpuser,smtppwd,smtpemail,jmail,isgo   
 3'收件人信息   
 4email="[email protected]" '//收信人地址   
 5title="你好!" '//标题   
 6msg="我的测试邮件!" '//信件内容   
 7  
 8'发送邮件参数设置   
 9smtpserver = "smtp.sina.com.cn" '//邮件服务器(我使用的是新浪的)   
10smtpuser = "lsqteng" '//你的用户名   
11smtpemail = "[email protected]" '//你的邮箱   
12smtppwd = "password" '//你的密码   
13  
14'发送邮件   
15Set jmail= server.CreateObject ("jmail.message")   
16jmail.Silent = true   
17jmail.Charset = "gb2312"   
18jMail.ContentType = "text/html"   
19jmail.From = "[email protected]" '//这里成你的发信人地址   
20jmail.FromName = "lsqteng" '//发信人姓名   
21  
22jmail.Subject = title '//标题   
23jmail.AddRecipient email '//地址   
24jmail.Body = msg '//内容   
25  
26jmail.MailServerUserName = smtpuser   
27jmail.MailServerPassWord = smtppwd   
28isgo = jmail.Send(smtpserver)   
29  
30if err then   
31SendMail= err.description   
32err.clear   
33else   
34SendMail="发送成功"   
35end if   
36jmail.Close   
37set jmail = nothing   
38  
39Response.Write SendMail   

---------------------------------------------------------------

我用这样的发送成功

Set msg = Server.CreateObject("JMail.Message")
msg.silent = true
msg.Logging = true
msg.Charset = "gb2312"
msg.MailServerUserName = "[email protected]" '输入smtp服务器验证登陆名 (邮局中任何一个用户的Email地址)
msg.MailServerPassword = "abc" '输入smtp服务器验证密码 (用户Email帐号对应的密码)
msg.From = "[email protected]" '发件人Email
msg.FromName = "aaa" '发件人姓名
msg.AddRecipient "[email protected]" '收件人Email
msg.Subject = "test" '信件主题
msg.Body = "testbody"
msg.Send ("mail.a.net") 'smtp服务器地址(企业邮局地址)
set msg = nothing

Published At
Categories with Web编程
Tagged with
comments powered by Disqus