Beispiel #1
0
        public static System.Net.Mail.MailMessage ConstruyeMensajeContacto(string nombre, string telefono, string email, string motivo)
        {
            System.Net.Mail.MailMessage sms = new System.Net.Mail.MailMessage();
            sms.Subject = "Formulario Contacto CPAS";
            sms.To.Add(Utiles.NOMBRE_SERVIDOR_CORREO());
            string habilitaCopiaAdmin1 = Utiles.HABILITA_COPIA_ADMIN1();

            if (habilitaCopiaAdmin1 == "1")
            {
                sms.To.Add(COPIA_ADMIN_1());
            }
            string habilitaCopiaAdmin2 = Utiles.HABILITA_COPIA_ADMIN1();

            if (habilitaCopiaAdmin2 == "1")
            {
                sms.To.Add(COPIA_ADMIN_2());
            }
            sms.From       = new System.Net.Mail.MailAddress("*****@*****.**", "CPAS");
            sms.IsBodyHtml = true;

            StringBuilder sb = new StringBuilder();

            sb.Append("<html>");

            string htmlMensaje = ObtenerMensajeXML("Contacto", true);

            if (htmlMensaje != null)
            {
                htmlMensaje = htmlMensaje.Replace("{Nombre}", nombre).Replace("{Telefono}", telefono).Replace("{Email}", email).Replace("{Motivo}", motivo);
                sb.Append(htmlMensaje);
            }
            else
            {
                sb.AppendFormat("{0}, Teléfono Contacto {1}, correo electónico {2}:<br />", nombre, telefono, email);
                sb.AppendFormat("Desea contactarse mediante el formulario de contacto, donde ha ingresado el siguiente motivo: {0}<br />", motivo);
                sb.Append("***** Mensaje enviado desde el sistema automático de envio de correos de CPAS ******");
            }
            sb.Append("</html>");
            sms.Body = sb.ToString();
            return(sms);
        }
Beispiel #2
0
        public static System.Net.Mail.MailMessage ConstruyeMensajeCrearEvento(string nombreInstitucion, string nombreEvento, string fechaInicioYTermino, string ubicacion, List <string> correos, bool esNuevo)
        {
            System.Net.Mail.MailMessage sms = new System.Net.Mail.MailMessage();
            sms.Subject = "Evento en CPAS";
            string habilitaCopiaAdmin1 = Utiles.HABILITA_COPIA_ADMIN1();

            if (habilitaCopiaAdmin1 == "1")
            {
                sms.To.Add(COPIA_ADMIN_1());
            }
            string habilitaCopiaAdmin2 = Utiles.HABILITA_COPIA_ADMIN1();

            if (habilitaCopiaAdmin2 == "1")
            {
                sms.To.Add(COPIA_ADMIN_2());
            }
            //recorremos la lista de usuarios de la institución
            if (correos != null && correos.Count > 0)
            {
                foreach (string s in correos)
                {
                    sms.To.Add(s);
                }
            }


            sms.From       = new System.Net.Mail.MailAddress("*****@*****.**", "CPAS");
            sms.IsBodyHtml = true;

            StringBuilder sb = new StringBuilder();

            sb.Append("<html>");
            if (esNuevo)
            {
                string htmlMensaje = ObtenerMensajeXML("Evento", true);
                if (htmlMensaje != null)
                {
                    htmlMensaje = htmlMensaje.Replace("{NombreItem}", nombreEvento).Replace("{NombreInstitucion}", nombreInstitucion).Replace("{FechaInicioTermino}", fechaInicioYTermino).Replace("{Url}", ObtenerUrl());
                    sb.Append(htmlMensaje);
                }
                else
                {
                    sb.AppendFormat("Se ha agregado el evento  <strong>{0}</strong>, para el Establecimiento {1}:<br />", nombreEvento, nombreInstitucion);
                    sb.AppendFormat("Estimado Usuario CPAS, ha sido agregado un evento para su establecimiento, este tendrá lugar en {0} entre {1}, ingrese a www.cpas.cl para poder verlo.", ubicacion, fechaInicioYTermino);
                    sb.Append("<br />");
                    sb.Append("***** Mensaje enviado desde el sistema automático de envio de correos de CPAS ****** <br />");
                    sb.Append("</html>");
                }
            }
            else
            {
                string htmlMensaje = ObtenerMensajeXML("Evento", false);
                if (htmlMensaje != null)
                {
                    htmlMensaje = htmlMensaje.Replace("{NombreItem}", nombreEvento).Replace("{NombreInstitucion}", nombreInstitucion).Replace("{FechaInicioTermino}", fechaInicioYTermino).Replace("{Url}", ObtenerUrl());
                    sb.Append(htmlMensaje);
                }
                else
                {
                    sb.AppendFormat("Ha sido modificado el evento  <strong>{0}</strong>, para el Establecimiento {1}:<br />", nombreEvento, nombreInstitucion);
                    sb.AppendFormat("Estimado Usuario CPAS, ha sido agregado un evento para su establecimiento, este tendrá lugar en {0} entre {1}, ingrese a www.cpas.cl para poder verlo.", ubicacion, fechaInicioYTermino);
                    sb.Append("<br />");
                    sb.Append("***** Mensaje enviado desde el sistema automático de envio de correos de CPAS ****** <br />");
                    sb.Append("</html>");
                }
            }

            sms.Body = sb.ToString();
            return(sms);
        }