1.怎么配置jmail组件
配置环境:.Net Framework 1.1,Imai8.02,w3Jmail4.3
实现过程:
不同于在Asp中使用Jmail,直接使用 Server.CreateObject("Jmail.Message")就可以了。在.Net环境中,需要进行设置。
1.安装jmail4.3
2.找到jmail.dll(Program Files\Dimac\w3JMail4下)
3.执行Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin\ildasm.exe(可使用Visual Studio .Net 2003 命令提示),
格式如下:tlbimp c:\Program Files\Dimac\w3JMail4\jmail.dll /out:myJmail.dll /namespace:myJmail
生成myJmail.dll后,copy到web的根目录的bin目录。在ASP.Net页面中,用这个方法引用:
Jmail.aspx
<%@ Page Language="C#" ContentType="text/html"%>
<%@ Import Namespace="myJmail" %>
<script runat="server">
protected void Page_Load(Object Src, EventArgs E)
{
Message jmail=new Message();
jmail.From="sss";
jmail.AddRecipient("lsg@ckocoo.com",null,null);
jmail.MailServerUserName="brookes";
jmail.MailServerPassWord="walkor";
jmail.Subject="jmail c#";
jmail.Send("mail.lsg.com",false);
</script>
Tlbimp:
Microsoft .Net Framework Type Library to Assembly Converter
2.关于jmail错误的解决方法的总结
on error resume next
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "xxx.xxx.xxx.xxx" '你服务器的IP或域名
JMail.LazySend = true
JMail.Charset = mcharset
JMail.ContentType = "text/html"
JMail.Sender = " ktmao@xxx.com" '发送者邮箱
JMail.Subject = "测试发邮件"
JMail.AddRecipient "xxx@xxx.com" '接收者邮箱
JMail.Body = "测试邮件"
JMail.Priority = 3
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.Execute
JMail.close
set JMail=nothing
if err.number<>0 then
response.write err.description
err.clear
else
response.write "发送成功"
end if