下面是几段C#发送邮件相关的代码,我也懒得说明了,就这么个意思。

                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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值