ASP.Net邮箱发邮件实例代码
public static void sendemail()
{
system.net.mail.smtpclient client = new system.net.mail.smtpclient();
//这里使用qq的邮箱来发送测试,如果是其它邮箱,请根据其它邮箱pop3/imap/smtp服务来设置
client.host = "smtp.qq.com";
client.usedefaultcredentials = false;
client.credentials = new system.net.networkcredential("6你的邮箱www.jb51.net", "***密码***");
client.deliverymethod = system.net.mail.smtpdeliverymethod.network;
system.net.mail.mailmessage message = new system.net.mail.mailmessage("60**你的*www.jb51.net"541**收件人的www.jb51.net");
message.subject = "主题";
message.body = "内容";
message.bodyencoding = system.text.encoding.utf8;
message.isbodyhtml = true;
try
{
client.send(message);
}
catch
{
}
}
上一篇: 实例解析Java中的构造器初始化