posts - 283, comments - 10329, trackbacks - 112, articles - 5
  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理

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

<%@ 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


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

Feedback

#1楼   回复  引用    

2006-02-06 13:41 by GoKu[未注册用户]
直接在项目里面添加引用就可以了,更简单

#2楼   回复  引用    

2006-02-20 01:26 by mOMo_TW[未注册用户]
ASP.NET內建的Mail功能是不是真的比JMail爛呀?

#3楼   回复  引用    

2006-04-16 16:05 by zmsx
我试了一下怎么不行,一直报错。

The message was undeliverable. All servers failed to receive the message
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.Runtime.InteropServices.COMException: The message was undeliverable. All servers failed to receive the message

源错误:


行 70: msg.AddRecipient("zmsx44@gmail.com","test",null);
行 71:
行 72: msg.Send("mail.163.com",false);
行 73: this.Response.Write("发送成功~");
行 74:


源文件: d:\inetpub\wwwroot\csdn\webform1.aspx.cs 行: 72

堆栈跟踪:


[COMException (0x8000ffff): The message was undeliverable. All servers failed to receive the message]
myJmail.MessageClass.Send(String mailServer, Boolean enque) +0
csdn.WebForm1.Button1_Click(Object sender, EventArgs e) in d:\inetpub\wwwroot\csdn\webform1.aspx.cs:72
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277



#4楼   回复  引用    

2006-07-02 14:56 by chinatefl[未注册用户]
The message was undeliverable. All servers failed to receive the message
我用163的邮箱测试一下,也不行

#5楼   回复  引用    

2006-08-10 17:20 by 路人1840[未注册用户]
163.com 不支持控件发送,试tom.com可能好一点.

#6楼   回复  引用    

2007-03-30 11:09 by kk[未注册用户]
我试了,发不出去

#7楼   回复  引用  查看    

2007-04-06 20:02 by DaiWei      
现在163在发送时,要使用SMTP身份认证的。
你使用这个对象的另外一个方法:就是使用SMTP身份认证的方法。
我试过,一定可以。

#8楼   回复  引用    

2008-01-30 15:38 by 晕晕晕[未注册用户]
"运行" CMD
regsvr32 d:\jmail.dll 回车



发表评论

昵称: [登录] [注册]

主页:

邮箱:(仅博主可见)

评论内容:

  登录  注册

[使用Ctrl+Enter键快速提交评论]

0 323575 jRvttTP4qY4=



历史上的今天:
2005-01-26 SAP之销售订单

相关文章:

相关链接: