惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 【当耐特】
Help Net Security
Help Net Security
P
Proofpoint News Feed
J
Java Code Geeks
爱范儿
爱范儿
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
F
Full Disclosure
Google DeepMind News
Google DeepMind News
H
Help Net Security
G
Google Developers Blog
Jina AI
Jina AI
Vercel News
Vercel News
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
Lohrmann on Cybersecurity
S
Schneier on Security
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
Security Archives - TechRepublic
Security Archives - TechRepublic
阮一峰的网络日志
阮一峰的网络日志
N
News and Events Feed by Topic
GbyAI
GbyAI
B
Blog
O
OpenAI News
博客园_首页
Cisco Talos Blog
Cisco Talos Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Hacker News: Ask HN
Hacker News: Ask HN
TaoSecurity Blog
TaoSecurity Blog
腾讯CDC
MongoDB | Blog
MongoDB | Blog
M
MIT News - Artificial intelligence
C
Cybersecurity and Infrastructure Security Agency CISA
Cyberwarzone
Cyberwarzone
Webroot Blog
Webroot Blog
Simon Willison's Weblog
Simon Willison's Weblog
Y
Y Combinator Blog
C
Cisco Blogs
A
Arctic Wolf
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Exploit Database - CXSecurity.com
Security Latest
Security Latest
AI
AI
W
WeLiveSecurity
aimingoo的专栏
aimingoo的专栏
The Register - Security
The Register - Security
Project Zero
Project Zero
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
Blog — PlanetScale
Blog — PlanetScale

博客园 - 老枪

sql 修改时间 接近完美的CSS标题、列表溢出隐藏 - 老枪 - 博客园 通过js读取或设置FCKeditor中的值 - 老枪 - 博客园 access查找表是否存在 css 如何设置 某div 里面的所有图片的最大宽度。当加入文章里图片时,图片自动按比例减小。 高素质图片压缩 Asp.net把UTF-8编码转换为GB2312编码 检索COM类工厂中CLSID...”的两个错误的解决方法 检索COM类工厂中CLSID...”的两个错误的解决方法 111111 Lucene基于Java的全文检索引擎简介 sql2005 中文分词 - 老枪 - 博客园 gridview使用大全 ASP.NET程序中常用的三十三种代码 - 老枪 - 博客园 40种网页常用小技巧(javascript) - 老枪 - 博客园 ASP.NET替换HTML代码<>中的任意代码 - 老枪 - 博客园 SQL SERVER 2005 同步复制技术 网页制作之在线视频播放代码 - 老枪 - 博客园 常用javascript数据验 - 老枪 - 博客园 asp.net2.0中,使用gridview显示新闻标题
使用System.Web.Mail通过需验证的邮件服务器发送邮件 - 老枪 - 博客园
老枪 · 2008-12-02 · via 博客园 - 老枪

using System;
using System.Web.Mail;

namespace ZZ
{
public class SystemMail
{
private string _adminEmail;
private string _smtpServer = "localhost";
private string _password;
private string _userName;

public SystemMail()
{
}

public string AdminEmail
{
get{return _adminEmail;}
set{_adminEmail = value;}
}

public string SmtpServer
{
get{return _smtpServer;}
set{_smtpServer = value;}
}

public string Password
{
get{return _password;}
set{_password = value;}
}

public string UserName
{
get{return _userName;}
set{_userName = value;}
}

public bool Send(string to, string from, string subject, string message)
{
try
{
MailMessage em = new MailMessage();
em.To = to;
em.From = from;
em.Subject = subject;
em.Body = message;

if(this.UserName != null && this.Password != null)
{
em.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
em.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", this.UserName); //set your username here
em.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", this.Password); //set your password here
}

SmtpMail.SmtpServer = this.SmtpServer;
SmtpMail.Send(em);
return true;
}
catch
{
return false;
}
}
}
}