public override int GetHashCode()
        {
            var hash = 3;

            hash = (hash * 2) + EnableLdapAuthentication.GetHashCode();
            hash = (hash * 2) + StartTls.GetHashCode();
            hash = (hash * 2) + Server.GetHashCode();
            hash = (hash * 2) + UserDN.GetHashCode();
            hash = (hash * 2) + PortNumber.GetHashCode();
            hash = (hash * 2) + UserFilter.GetHashCode();
            hash = (hash * 2) + LoginAttribute.GetHashCode();
            hash = (hash * 2) + FirstNameAttribute.GetHashCode();
            hash = (hash * 2) + SecondNameAttribute.GetHashCode();
            hash = (hash * 2) + MailAttribute.GetHashCode();
            hash = (hash * 2) + TitleAttribute.GetHashCode();
            hash = (hash * 2) + MobilePhoneAttribute.GetHashCode();
            hash = (hash * 2) + LocationAttribute.GetHashCode();
            hash = (hash * 2) + GroupMembership.GetHashCode();
            hash = (hash * 2) + GroupDN.GetHashCode();
            hash = (hash * 2) + GroupNameAttribute.GetHashCode();
            hash = (hash * 2) + GroupFilter.GetHashCode();
            hash = (hash * 2) + UserAttribute.GetHashCode();
            hash = (hash * 2) + GroupAttribute.GetHashCode();
            hash = (hash * 2) + Authentication.GetHashCode();
            hash = (hash * 2) + Login.GetHashCode();
            return(hash);
        }
Esempio n. 2
0
        public bool SendEmail(MailAttribute objMailAttribute)
        {
            try
            {
                MailAddress from    = new MailAddress(objMailAttribute.FromEmailId);
                MailAddress to      = new MailAddress(objMailAttribute.ToEmailId);
                MailMessage message = new MailMessage(from, to);

                message.Subject    = objMailAttribute.Subject;
                message.Body       = objMailAttribute.Body;
                message.IsBodyHtml = true;
                string cc = "";
                if (objMailAttribute.CcList != null)
                {
                    for (int counter = 0; counter < objMailAttribute.CcList.Count; counter++)
                    {
                        if (counter == 0)
                        {
                            cc = objMailAttribute.CcList[counter];
                        }
                        else
                        {
                            cc += "," + objMailAttribute.CcList[counter];
                        }
                    }
                    message.CC.Add(cc);
                }
                //message.CC.Add(cc);

                SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
                // Include credentials if the server requires them.
                //client.Credentials = CredentialCache.DefaultNetworkCredentials;
                var nc = new NetworkCredential(objMailAttribute.FromEmailId, objMailAttribute.PassWord);

                client.EnableSsl             = true;
                client.UseDefaultCredentials = false;
                client.Credentials           = nc;
                client.Send(message);
                return(true);
            }
            catch (Exception ex)
            {
                throw;
            }
        }