会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
常用连接:
博客首页
随想感悟
编程技术
工程管理
互联网
其他随记
关于
悟心集
面对自己,找寻真我,战胜自我,摆脱自我
博客园
首页
新随笔
联系
订阅
管理
用.net自带的类发送E_Mail(ASP.NET+C#)
using
System.Web.Util;
using
System.Web.Mail;
using
System.Net;
private
void
Button2_Click(
object
sender, System.EventArgs e)
{
try
{
MailMessage Message
=
new
MailMessage();
Message.To
=
"
laihua0316@163.com
"
;
Message.From
=
"
laihua80316@163.com
"
;
Message.Subject
=
"
今天心情很好!!
"
;
Message.Body
=
"
祝大家工作愉快!!
"
;
Message.Fields.Add(
"
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate
"
,
"
1
"
);
Message.Fields.Add(
"
http://schemas.microsoft.com/cdo/configuration/sendusername
"
,
"
laihua80316
"
);
//
Message.Fields.Add(
"
http://schemas.microsoft.com/cdo/configuration/sendpassword
"
,
"
******
"
);
//
SmtpMail.SmtpServer
=
"
smtp.163.com
"
;
SmtpMail.Send(Message);
Response.Write(
"
<script>alert('ok')</
"
+
"
script>
"
);
}
catch
{
Response.Write(
"
<script>alert('fail')</
"
+
"
script>
"
);
}
}
posted on
2005-03-31 16:51
dragonpro
阅读(
390
) 评论(
0
)
收藏
举报
刷新页面
返回顶部