Ejemplo n.º 1
0
        /// <summary>
        /// Sends the contact email.
        /// </summary>
        /// <returns>The contact email.</returns>
        /// <param name="m">M.</param>
        private string SendContactEmail(ContactModel m)
        {
            try
            {
                string htmlBody = "<p>{0}, was unable to complete the SagicorNow application online in {3}, on {5} at {6}.</p><p>The reason for being unable to proceed was:<br /><br /><b>{4}</b></p><p>The client would like a Sagicor Life agent to contact them at {1}, or {2}.</p>";

                Utils.EmailManager mgr = new Utils.EmailManager();
                mgr.SendEmail(new Utils.SmtpOptions(),                 //options, use defaults
                              new List <string>()
                {
                    "*****@*****.**", "*****@*****.**"
                },                                                                                                         //recipients
                              "*****@*****.**",                                                                    //from address
                              String.Format("SagicorNow client ({0}) unable to complete application online", m.firstName), //subject
                              "",                                                                                          //plain text?
                              htmlBody                                                                                     //html text
                              );

                return("SUCCESS");
            }
            catch (Exception ex)
            {
                ViewBag.Status = "Problem while sending email, Please check details." + ex.Message;
                return("ERROR");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sends the contact email.
        /// </summary>
        /// <returns>The contact email.</returns>
        /// <param name="m">M.</param>
        private string SendContactEmail(ContactModel m)
        {
            try
            {
                string htmlBody = "";
                string subject  = "";

                if (!String.IsNullOrEmpty(m.comment))
                {
                    subject  = "SagicorNow client ({0}) sent a comment";
                    htmlBody = String.Format("<p>{0}, shared the comment below, on {5} at {6}: </p><p><br /><br /><b>{4}</b></p><p>The client would like to be contacted at {1}, or {2}.</p>", m.firstName, m.email, m.phone, m.state, m.comment,
                                             DateTime.Today.ToString("D", CultureInfo.CreateSpecificCulture("en-US")), DateTime.Now.ToString("hh:mm tt", CultureInfo.InvariantCulture));
                }
                else
                {
                    subject  = "SagicorNow client ({0}) unable to complete application online";
                    htmlBody = String.Format("<p>{0}, was unable to complete the SagicorNow application online in {3}, on {5} at {6}.</p><p>The reason for being unable to proceed was:<br /><br /><b>{4}</b></p><p>The client would like a Sagicor Life agent to contact them at {1}, or {2}.</p>", m.firstName, m.email, m.phone, m.state, m.denialMessage,
                                             DateTime.Today.ToString("D", CultureInfo.CreateSpecificCulture("en-US")), DateTime.Now.ToString("hh:mm tt", CultureInfo.InvariantCulture));
                }

                Utils.EmailManager mgr = new Utils.EmailManager();
                mgr.SendEmail(new Utils.SmtpOptions(), //options, use defaults
                              new List <string>()
                {
                    "*****@*****.**"
                },                                                 //recipients
                              "*****@*****.**",            //from address
                              String.Format(subject, m.firstName), //subject
                              "",                                  //plain text?
                              htmlBody                             //html text
                              );

                return("SUCCESS");
            }
            catch (Exception ex)
            {
                ViewBag.Status = "Problem while sending email, Please check details." + ex.Message;
                return("ERROR");
            }
        }