下面是几段C#发送邮件相关的代码,我也懒得说明了,就这么个意思。
来源:互联网 发布:淘宝开店怎么样 编辑:程序博客网 时间:2024/04/27 23:30
mailObj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mailObj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "joe.zhou");
mailObj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "zhou");
//for SMTP Authentication
if (Globals.GetSiteSettings(context).SmtpServerRequiredLogin) {
m.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1" ); //basic authentication
m.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", Globals.GetSiteSettings(context).SmtpServerUserName ); //set your username here
m.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", Globals.GetSiteSettings(context).SmtpServerPassword ); //set your password here
// by venjiang 2004/12/31
// 超时时间增加
m.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60);
}
#region 应用程序初始化
/// <summary>
/// 应用程序初始化
/// </summary>
/// <param name="application"></param>
public void Init(HttpApplication application)
{
// Wire-up application events
//
application.ResolveRequestCache += new EventHandler(this.BlockedIpAddress);
application.BeginRequest += new EventHandler(this.Application_BeginRequest);
application.AuthenticateRequest += new EventHandler(Application_AuthenticateRequest);
application.Error += new EventHandler(this.Application_OnError);
application.AuthorizeRequest += new EventHandler(this.Application_AuthorizeRequest);
#if DEBUG
application.ReleaseRequestState += new EventHandler(this.Application_ReleaseRequestState);
#endif
ForumConfiguration forumConfig = ForumConfiguration.GetConfig();
if( forumConfig != null
&& forumConfig.IsBackgroundThreadingDisabled == false ) {
if (emailTimer == null)
emailTimer = new Timer(new TimerCallback(ScheduledWorkCallbackEmailInterval), application.Context, EmailInterval, EmailInterval);
if( forumConfig.IsIndexingDisabled == false
&& statsTimer == null ) {
statsTimer = new Timer(new TimerCallback(ScheduledWorkCallbackStatsInterval), application.Context, StatsInterval, StatsInterval);
}
}
}
#endregion
mailObj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "joe.zhou");
mailObj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "zhou");
//for SMTP Authentication
if (Globals.GetSiteSettings(context).SmtpServerRequiredLogin) {
m.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1" ); //basic authentication
m.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", Globals.GetSiteSettings(context).SmtpServerUserName ); //set your username here
m.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", Globals.GetSiteSettings(context).SmtpServerPassword ); //set your password here
// by venjiang 2004/12/31
// 超时时间增加
m.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60);
}
#region 应用程序初始化
/// <summary>
/// 应用程序初始化
/// </summary>
/// <param name="application"></param>
public void Init(HttpApplication application)
{
// Wire-up application events
//
application.ResolveRequestCache += new EventHandler(this.BlockedIpAddress);
application.BeginRequest += new EventHandler(this.Application_BeginRequest);
application.AuthenticateRequest += new EventHandler(Application_AuthenticateRequest);
application.Error += new EventHandler(this.Application_OnError);
application.AuthorizeRequest += new EventHandler(this.Application_AuthorizeRequest);
#if DEBUG
application.ReleaseRequestState += new EventHandler(this.Application_ReleaseRequestState);
#endif
ForumConfiguration forumConfig = ForumConfiguration.GetConfig();
if( forumConfig != null
&& forumConfig.IsBackgroundThreadingDisabled == false ) {
if (emailTimer == null)
emailTimer = new Timer(new TimerCallback(ScheduledWorkCallbackEmailInterval), application.Context, EmailInterval, EmailInterval);
if( forumConfig.IsIndexingDisabled == false
&& statsTimer == null ) {
statsTimer = new Timer(new TimerCallback(ScheduledWorkCallbackStatsInterval), application.Context, StatsInterval, StatsInterval);
}
}
}
#endregion
- 下面是几段C#发送邮件相关的代码,我也懒得说明了,就这么个意思。
- 我的第一个blog,也被csdn夺走了,算了,就这样了..
- 用C#写了一个新增用户就发送邮件和手机短信的SqlServer触发器
- 用C#写了一个新增用户就发送邮件和手机短信的SqlServer触发器
- 用C#写了一个新增用户就发送邮件和手机短信的SqlServer触发器(
- 我的网易博客啊!!!就这么没了!!!
- C#发送邮件代码
- C#邮件发送代码
- C#发送邮件代码
- C#邮件发送代码
- C#发送邮件代码
- C#发送邮件代码
- C#发送邮件代码
- C#邮件发送代码
- C#发送邮件代码
- C#发送邮件代码
- C#发送邮件代码
- C#发送邮件代码
- 只允许创建一个实例的VB.NET窗口
- [转贴]取得拼音字头的存储过程
- 世说新语--IT篇
- JabRef 抓图
- 读写INI配置文件的Java类
- 下面是几段C#发送邮件相关的代码,我也懒得说明了,就这么个意思。
- 在Eclipse下配置自定义模板(原创)
- 读书:《中国问题》by罗素
- 日语学习的实用网址大全
- Firefox放出1.5 beta,正在使用,但是插件基本都不兼容
- Ruby on Rails 他山的宝石 - 改进我们的struts!
- SQL Server存储过程编写和优化措施
- 到今天为止,问题差不多解决,
- 用JBuilder9开发Struts应用