当前位置:首页 > ASP.Net环境下使用Jmail组件发送邮件

ASP.Net环境下使用Jmail组件发送邮件

点击次数:963  更新日期:2010-12-27
\n

配置环境:.Net Framework 1.1,Imai8.02,w3Jmail4.3


\n

实现过程:


\n

不同于在Asp中使用Jmail,直接使用 Server.CreateObject(“Jmail.Message”)就可以了。在.Net环境中,需要进行设置。


\n

1.安装jmail4.3


\n

2.找到jmail.dll(Program Files\\Dimac\\w3JMail4下)


\n

3.执行Program Files\\Microsoft Visual Studio .NET\\FrameworkSDK\\Bin\\ildasm.exe(可使用Visual Studio .Net 2003 命令提示),


\n

格式如下:tlbimp c:\\Program Files\\Dimac\\w3JMail4\\jmail.dll /out:myJmail.dll /namespace:myJmail


\n

生成myJmail.dll后,copy到web的根目录的bin目录。在ASP.Net页面中,用这个方法引用:


\n

Jmail.aspx
阅读代码编辑代码运行效果复制HTML代码保存代码<%@ Page Language=”C#” ContentType=”text/html” %>


\n

<%@ Import Namespace=”myJmail” %>
<script runat=”server”>
protected void Page_Load(Object Src, EventArgs E)
{
Message jmail = new Message();


\n

jmail.From = “sss”;
jmail.AddRecipient(“lsg@ckocoo.com”, null, null);
jmail.MailServerUserName = “brookes”;
jmail.MailServerPassWord = “walkor”;
jmail.Subject = “jmail c#”;


\n

jmail.Send(“mail.lsg.com”, false);
}
</script><%@ Page Language=”C#” ContentType=”text/html” %>


\n

<%@ Import Namespace=”myJmail” %>
<script runat=”server”>
protected void Page_Load(Object Src, EventArgs E)
{
Message jmail = new Message();


\n

jmail.From = “sss”;
jmail.AddRecipient(“lsg@ckocoo.com”, null, null);
jmail.MailServerUserName = “brookes”;
jmail.MailServerPassWord = “walkor”;
jmail.Subject = “jmail c#”;


\n

jmail.Send(“mail.lsg.com”, false);
}
</script>


\n

Tlbimp:


\n

Microsoft .Net Framework Type Library to Assembly Converter


\n

真是晕啊,没想到.NET里有这个功能啊,我照上面的进行了转换,确实发送成功了!!:)


\n

来源:网络

\n