当前位置:编程学习 > C#/ASP.NET >>

第二部分,公共属性

答案:接上
--------------------------------------
/// <summary>
/// 最多收件人数量
/// </summary>
public int RecipientMaxNum
{
    set
    {
        recipientmaxnum = value;
    }
}

/// <summary>
/// 邮件服务器域名和验证信息
/// 形如:"user:pass@www.server.com:25",也可省略次要信息。如"user:pass@www.server.com"或"www.server.com"
/// </summary>    
public string MailDomain
{
    set
    {
        string maidomain=value.Trim();
        int tempint;

        if(maidomain!="")
        {
            tempint=maidomain.IndexOf("@");
            if(tempint!=-1)
            {
            string str=maidomain.Substring(0,tempint);
                        MailServerUserName=str.Substring(0,str.IndexOf(":"));
                        MailServerPassWord=str.Substring(str.IndexOf(":")+1,str.Length-str.IndexOf(":")-1);
                        maidomain=maidomain.Substring(tempint+1,maidomain.Length-tempint-1);
            }
                tempint=maidomain.IndexOf(":");
            if(tempint!=-1)
            {
                mailserver=maidomain.Substring(0,tempint);
                        mailserverport=System.Convert.ToInt32(maidomain.Substring(tempint+1,maidomain.Length-tempint-1));
                    }
                    else
                    {
                        mailserver=maidomain;

                    }

                
                }

            }
        }


        /// <summary>
        /// 邮件服务器端口号
        /// </summary>    
        public int MailDomainPort
        {
            set
            {
                mailserverport=value;
            }
        }


        /// <summary>
        /// SMTP认证时使用的用户名
        /// </summary>
        public string MailServerUserName
        {
            set
            {
                if(value.Trim()!="")
                {
                    username=value.Trim();
                    ESmtp=true;
                }
                else
                {
                    username="";
                    ESmtp=false;
                }
            }
        }


        /// <summary>
        /// SMTP认证时使用的密码
        /// </summary>
        public string MailServerPassWord
        {
            set
            {
                password=value;
            }
        }    


        /// <summary>
        /// 邮件发送优先级,可设置为"High","Normal","Low"或"1","3","5"
        /// </summary>
        public string Priority
        {
            set
            {
           

上一个:C# 刚写的 HttpRequsetResponse 类,异步、事件... 还热乎着呢!
下一个:第三部分,构造函数和公共过程

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,