≮崩溃≯不劳阁,俺的blog纯粹属于好玩,如有雷同 纯属巧合!
19 Dec
default.cs
//region 发送邮件
static public void sendmail(string sendto, string subject, string body)
{
// **** 代表邮件服务器
smtpclient client = new smtpclient("******");
client.usedefaultcredentials = true;
// 此处是用户名和密码
client.credentials = new networkcredential("zhangbaozz", "123456");
client.deliverymethod = smtpdeliverymethod.network;
// 邮箱
mailmessage message = new mailmessage(zhangbaozz@***.com, sendto, subject, body);
message.bodyencoding = encoding.getencoding("gb2312");
message.isbodyhtml = true;
try
{
client.send(message);
return;
}
catch { return; }
}
//endregion
呵呵~ 顺便把asp的也一起发了吧....asp的要安装jmail组件
<%
sub jmail_new(email,topic,mailbody,rename,remail)
email 发送的邮件地址
topic 标题
mailbody 邮件主要内容
rename 回复人姓名
remail回复的邮件地址
on error resume next
dim jmail
set jmail=server.createobject("jmail.message")
jmail.logging=true
jmail.charset="gb2312"
jmail.mailserverusername = "****@****.com" 您的邮件服务器登录名
jmail.mailserverpassword = "****" 登录密码
jmail.priority = 1
=========这两个属性低版本的不支持
jmail.sendername=rename
发送者邮件地址
jmail.sender = remail
自动回复地址
===============
jmail.replyto=remail
jmail.from="*****"
jmail.fromname =rename
jmail.addrecipient email
jmail.subject=topic
jmail.htmlbody=mailbody
jmail.body=""
jmail.send ("mail.gkong.com")
set jmail=nothing
sendmail="ok"
if err then
sendmail="false"
response.write sendmail
end if
end sub
%>
asdas
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。