Common/SmtpMail.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/**********************************************
 * 类作用:   Smtp邮件辅助类
 * 建立人:   abaal
 * 建立时间: 2008-09-03 
 * Copyright (C) 2007-2008 abaal
 * All rights reserved
 * http://blog.csdn.net/abaal888
 ***********************************************/

using System;
using System.Net;
using System.Net.Configuration;
using System.Net.Mail;
using System.Text;
using System.Web.Configuration;
using System.Collections.Generic;

namespace Svnhost.Common
{
    /// <summary>
    /// Smtp配置
    /// </summary>
    public class SmtpConfig
    {
        /// <summary>
        /// SMTP在web.config的默认配置
        /// </summary>
        public SmtpConfig()
        {
            setWebConfigBindding();
            ContentEncoding = Encoding.Default;
        }

        private void setWebConfigBindding()
        {
            try
            {
                MailSettingsSectionGroup sectionGroup = (MailSettingsSectionGroup)WebConfigurationManager.OpenWebConfiguration("~/").GetSectionGroup("system.net/mailSettings");
                if (sectionGroup == null)
                {
                    SmtpServer = "localhost";
                    Port = 25;
                    SSLConnect = false;
                }
                else
                {

                    if (sectionGroup.Smtp.Network.Host != "")
                    {
                        SmtpServer = sectionGroup.Smtp.Network.Host;
                    }
                    Port = sectionGroup.Smtp.Network.Port;
                    UserName = sectionGroup.Smtp.Network.UserName;
                    Password = sectionGroup.Smtp.Network.Password;

                    if (sectionGroup.Smtp.Network.DefaultCredentials == true)
                    {
                        Credentials = null;
                    }
                    else
后面还有 174 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。