난잡한 코드

6930 단어 code
        /// <summary>

        ///     

         /// </summary>

        /// <param name="fromEmails">     </param>

        /// <param name="myEmail">     </param>

        /// <param name="name">     </param>

        /// <param name="title">    </param>

        /// <param name="conent">    </param>

        /// <returns></returns>

        public static Boolean SendMail(String[] fromEmails, String myEmail, String name, String title, String content)

        {

            try

            {

                System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();

                foreach (String email in fromEmails)

                {

                    msg.To.Add(email);

                }

                msg.From = new MailAddress(myEmail, name);

                /*   3           (     ),     ,  */

                msg.Subject = title;//     

                msg.SubjectEncoding = System.Text.Encoding.UTF8;//       

                msg.Body = content;//     

                msg.BodyEncoding = System.Text.Encoding.UTF8;//       

                msg.IsBodyHtml = true;//   HTML   

                msg.Priority = System.Net.Mail.MailPriority.High;

                SmtpClient client = new SmtpClient();

                client.UseDefaultCredentials = false;

                client.Credentials = new System.Net.NetworkCredential(myEmail, "");//   szmorning.com.cn       

                client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;//     ,      ,    Network  ,      ,  PickupDirectoryFromIis  IIS OK 

                client.Send(msg);

                return true;

            }

            catch (System.Net.Mail.SmtpException ex)

            {

                String message = ex.Message;

                return false;

            }

        }
    :
 
<system.net>

        <mailSettings>

            <smtp>

                <!--<network host="mail.chevroletsingapore.com" userName="[email protected]" password="password"/>-->

                <network host="       "/> //163.com

            </smtp>

        </mailSettings>

    </system.net>

 
            url  
protected static Boolean IsMatchUrl(String path) 

        {

            String regExp = String.Empty;

            regExp = @"^((https|http|ftp|rtsp|mms)?://)"

            + @"?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp user@ 

            + @"(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP   URL- 221.2.162.15

            + @"|" //   IP DOMAIN(  )

            + @"([0-9a-z_!~*'()-]+\.)*" //   - www. 

            + @"([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." //      

            + @"[a-z]{2,6})" // first level domain- .com or .museum 

            + @"(:[0-9]{1,4})?" //   - :80 

            + @"((/?)|" // a slash isn't required if there is no file name 

            + @"(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";

            regex = new Regex(regExp);

            return regex.IsMatch(path);

        }

좋은 웹페이지 즐겨찾기