public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = WebApp != null?WebApp.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (Hosts != null ? Hosts.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (ToEmail != null ? ToEmail.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (FromEmail != null ? FromEmail.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (ServicePlanResourceGroup != null ? ServicePlanResourceGroup.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (SiteSlotName != null ? SiteSlotName.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (GroupName != null ? GroupName.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (WebAppEnvironmentParams != null ? WebAppEnvironmentParams.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (AzureDnsEnvironmentParams != null ? AzureDnsEnvironmentParams.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (AzureDnsZoneName != null ? AzureDnsZoneName.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (AzureDnsRelativeRecordSetName != null ? AzureDnsRelativeRecordSetName.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (GoDaddyDnsEnvironmentParams != null ? GoDaddyDnsEnvironmentParams.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ UseIpBasedSsl.GetHashCode();
                hashCode = (hashCode * 397) ^ RsaKeyLength;
                hashCode = (hashCode * 397) ^ (AcmeBaseUri != null ? AcmeBaseUri.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (WebRootPath != null ? WebRootPath.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ RenewXNumberOfDaysBeforeExpiration;
                hashCode = (hashCode * 397) ^ (AuthenticationUri != null ? AuthenticationUri.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (AzureTokenAudience != null ? AzureTokenAudience.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (AzureManagementEndpoint != null ? AzureManagementEndpoint.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (AzureDefaultWebsiteDomainName != null ? AzureDefaultWebsiteDomainName.GetHashCode() : 0);
                return(hashCode);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handle the exception
        /// </summary>
        /// <param name="ex">The exception to be handled</param>
        /// <param name="message">An additional message to be included in the error email body</param>
        public static void HandleException(Exception ex, string message)
        {
            if (!StringUtils.IsBlank(ToEmail))
            {
                try
                {
                    Email email = Email.Create();

                    email.FromEmail = FromEmail;

                    foreach (string recipient in ToEmail.Split(';'))
                    {
                        if (StringUtils.IsEmail(recipient))
                        {
                            email.Recipients.Add(recipient);
                        }
                    }

                    email.Subject     = Subject;
                    email.Body        = GetBody(ex, message);
                    email.IsHtml      = true;
                    email.IsDebugMode = false;

                    email.Send();
                }
                catch (Exception hex)
                {
                    m_Logger.Warn("Error handling error", hex);
                }
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ToEmail toEmail = db.ToEmails.Find(id);

            db.ToEmails.Remove(toEmail);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,Name,Email")] ToEmail toEmail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(toEmail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(toEmail));
 }
        public ActionResult Create([Bind(Include = "ID,Name,Email")] ToEmail toEmail)
        {
            if (ModelState.IsValid)
            {
                db.ToEmails.Add(toEmail);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(toEmail));
        }
        // GET: ToEmails/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ToEmail toEmail = db.ToEmails.Find(id);

            if (toEmail == null)
            {
                return(HttpNotFound());
            }
            return(View(toEmail));
        }
Exemplo n.º 7
0
//        Outgoing Mail (SMTP) Server - requires TLS or SSL:
//smtp.gmail.com
//Use Authentication: Yes
//Port for TLS/STARTTLS: 587
//Port for SSL: 465
//Server timeouts	 Greater than 1 minute, we recommend 5

//Full Name or Display Name:	 [your name]
//Account Name or User Name:	 your full email address (including @gmail.com or @your_domain.com)
//Email Address:	 your email address ([email protected] or username@your_domain.com)
//Password:	 your Gmail password


        public void Send()
        {
            bool isEmailEnabled = true;

            bool.TryParse(ConfigurationManager.AppSettings["EmailEnable"], out isEmailEnabled);
            if (!isEmailEnabled)
            {
                return;
            }


            SmtpClient smtp = new SmtpClient();

            smtp.Host                  = GmailHost;
            smtp.Port                  = GmailPort;
            smtp.EnableSsl             = GmailSSL;
            smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;
            smtp.UseDefaultCredentials = false;
            smtp.Credentials           = new NetworkCredential(GmailUsername, GmailPassword);

            var message = new MailMessage();

            message.From = new MailAddress(GmailUsername);

            string[] ToMuliId = ToEmail.Split(',');
            foreach (string ToEMailId in ToMuliId)
            {
                message.To.Add(new MailAddress(ToEMailId)); //adding multiple TO Email Id
            }
            if (!string.IsNullOrEmpty(CC))
            {
                string[] CCId = CC.Split(',');

                foreach (string CCEmail in CCId)
                {
                    message.CC.Add(new MailAddress(CCEmail)); //Adding Multiple CC email Id
                }
            }

            //using (var message = new MailMessage(GmailUsername, ToEmail))
            //{

            message.Subject    = Subject;
            message.Body       = Body;
            message.IsBodyHtml = IsHtml;
            smtp.Send(message);
            //}
        }
Exemplo n.º 8
0
        //        Outgoing Mail (SMTP) Server - requires TLS or SSL:
        //smtp.gmail.com
        //Use Authentication: Yes
        //Port for TLS/STARTTLS: 587
        //Port for SSL: 465
        //Server timeouts	 Greater than 1 minute, we recommend 5

        //Full Name or Display Name:	 [your name]
        //Account Name or User Name:	 your full email address (including @gmail.com or @your_domain.com)
        //Email Address:	 your email address ([email protected] or username@your_domain.com)
        //Password:	 your Gmail password


        public void Send()
        {
            SmtpClient smtp = new SmtpClient();

            smtp.Host                  = GmailHost;
            smtp.Port                  = GmailPort;
            smtp.EnableSsl             = GmailSSL;
            smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;
            smtp.UseDefaultCredentials = false;
            smtp.Credentials           = new NetworkCredential(GmailUsername, GmailPassword);

            var message = new MailMessage();

            message.From = new MailAddress(GmailUsername);

            string[] ToMuliId = ToEmail.Split(',');
            foreach (string ToEMailId in ToMuliId)
            {
                message.To.Add(new MailAddress(ToEMailId)); //adding multiple TO Email Id
            }

            string[] CCId = CC.Split(',');

            foreach (string CCEmail in CCId)
            {
                message.CC.Add(new MailAddress(CCEmail)); //Adding Multiple CC email Id
            }


            //using (var message = new MailMessage(GmailUsername, ToEmail))
            //{

            message.Subject    = Subject;
            message.Body       = Body;
            message.IsBodyHtml = IsHtml;
            smtp.Send(message);
            //}
        }
Exemplo n.º 9
0
        public string Send()
        {
            string strMsg = string.Empty;

            try
            {
                SmtpClient smtp = new SmtpClient();
                smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;
                smtp.UseDefaultCredentials = false;
                smtp.Credentials           = new NetworkCredential(MailUsername, MailPassword);
                smtp.Port      = MailPort;
                smtp.Host      = MailHost;
                smtp.EnableSsl = MailSSL;
                using (var message = new MailMessage())
                {
                    message.From = new MailAddress(MailUsername);
                    foreach (string address in ToEmail.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        if (!string.IsNullOrEmpty(address))
                        {
                            message.To.Add(address);
                        }
                    }
                    foreach (string address in CCEmail.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        if (!string.IsNullOrEmpty(address))
                        {
                            message.CC.Add(address);
                        }
                    }
                    message.Subject    = Subject;
                    message.Body       = Body;
                    message.IsBodyHtml = IsHtml;
                    if (FileName != null)
                    {
                        message.Attachments.Add(new Attachment(EmailAttachment, FileName));
                    }
                    try
                    {
                        if (fileNameList.Count > 0)
                        {
                            for (int i = 0; i < fileNameList.Count; i++)
                            {
                                message.Attachments.Add(new Attachment(emailAttachmentsList[i], fileNameList[i]));
                            }
                        }
                    }
                    catch (Exception fileex)
                    {
                        strMsg = " " + fileex.ToString();
                    }
                    smtp.Send(message);
                }
                strMsg = "Success";
            }
            catch (Exception ex)
            {
                strMsg = "Fail : " + ex.ToString();
            }
            return(strMsg);
        }