ASP.Net环境下使用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

1@ Page Language="C#" ContentType="text/html"
1@ Import Namespace="myJmail" 
 1<script runat="server">
 2
 3protected void Page_Load(Object Src, EventArgs E) 
 4
 5{ 
 6
 7Message jmail=new Message(); 
 8
 9jmail.From="sss"; 
10
11jmail.AddRecipient(" [email protected]",null,null ); 
12
13jmail.MailServerUserName="brookes"; 
14
15jmail.MailServerPassWord="walkor"; 
16
17jmail.Subject="jmail c#"; 
18
19jmail.Send("mail.lsg.com",false); 
20
21</script>

Tlbimp:

Microsoft .Net Framework Type Library to Assembly Converter

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