Exemple #1
0
        public void SendEmail(string strSendTo, string strSendFrom, string strSendCC, string strTitle, string strMsgBody)
        {
            ArrayList arrSendTo = Gadget.Split(strSendTo, ";");
            ArrayList arrSendCC = Gadget.Split(strSendCC, ";");

            for (int i = 0; i < arrSendTo.Count; i++)
            {
                msg.CC.Add(arrSendTo[i].ToString());
            }
            for (int i = 0; i < arrSendTo.Count; i++)
            {
                msg.To.Add(arrSendCC[i].ToString());
            }
            msg.From         = new MailAddress(strSendFrom);
            msg.Subject      = strTitle;
            msg.Body         = strMsgBody;
            msg.IsBodyHtml   = true;
            msg.Priority     = MailPriority.High;
            msg.BodyEncoding = ASCIIEncoding.Unicode;
            try
            {
                //client.Credentials = new NetworkCredential("*****@*****.**", "");
                client.Credentials = CredentialCache.DefaultNetworkCredentials;
                client.Timeout     = 0;
                client.EnableSsl   = true;
                client.Send(msg);
            }
            catch (Exception ex)
            {
                msg.Dispose();
                client.Dispose();

                Hashtable hshParam = new Hashtable();
                hshParam.Add("UID", Gadget.GetUserID());
                hshParam.Add("Error", ex.Message);
                Expose178.Com.UtilityFactory.Log.WriteLog(hshParam, "Expose178.Com.Utility.SendEmail()", Expose178.Com.UtilityFactory.LogType.LogToDB);
            }
        }