Ejemplo n.º 1
0
        public void sendEmail(SMTPEmail email)
        {
            try
            {
                Auxiliar aux = new Auxiliar();
                MailMessage Email;

                Email = new MailMessage(email.From, email.To, email.subject, email.Message);

                SmtpClient smtpMail = new SmtpClient(email.SMTPClient);
                Email.IsBodyHtml = true;

                smtpMail.UseDefaultCredentials = false;
                smtpMail.Host = email.SMTPClient;
                smtpMail.Port = email.SMTPPort;
                smtpMail.EnableSsl = false;
                smtpMail.Credentials = new NetworkCredential(aux.GetGeneralParameterValue("EmailSMTP Sitio"), aux.GetGeneralParameterValue("PasswordSMTP Sitio"));//[email protected] // Aep123456

                smtpMail.Send(Email);
            }
            catch (Exception ex)
            {
                this.lblMessage.InnerText = ex.Message;
            }
        }
Ejemplo n.º 2
0
        private void sendEmail(TechLogInformation tech)
        {
            try
            {
                Auxiliar aux = new Auxiliar();
                SMTPEmail email = new SMTPEmail();

                email.From = aux.GetGeneralParameterValue("EmailSMTP Error");
                email.To = aux.GetGeneralParameterValue("ToEmail Error");
                email.subject = aux.GetGeneralParameterValue("Subject Error");
                email.SMTPClient = aux.GetGeneralParameterValue("SMTP Client");
                email.SMTPPort = Convert.ToInt32(aux.GetGeneralParameterValue("SMTP Port"));

                email.Message = "<label style=\"display:block;\">Página: " + tech.ClassName + "</label></br></br><label style=\"display:block;\">Método: " + tech.MethodName + "</label></br></br><label style=\"display:block;\">Excepción: " + tech.ExceptionDetail + "</label></br></br>";

                MailMessage Email;

                Email = new MailMessage(email.From, email.To, email.subject, email.Message);

                SmtpClient smtpMail = new SmtpClient(email.SMTPClient);
                Email.IsBodyHtml = true;

                smtpMail.UseDefaultCredentials = false;
                smtpMail.Host = email.SMTPClient;
                smtpMail.Port = email.SMTPPort;
                smtpMail.EnableSsl = false;
                smtpMail.Credentials = new NetworkCredential(aux.GetGeneralParameterValue("EmailSMTP Error"), aux.GetGeneralParameterValue("PasswordSMTP Error"));//[email protected] // Aep123456

                smtpMail.Send(Email);
            }
            catch (Exception ex)
            {
                //log the error
                SaveTechLog(System.Reflection.MethodBase.GetCurrentMethod().Name, LevelError.ERROR, ex);
                throw ex;
            }
        }
Ejemplo n.º 3
0
        protected void btnEnviar_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.ValidateData())
                {
                    Auxiliar aux = new Auxiliar();
                    SMTPEmail email = new SMTPEmail();

                    email.From = aux.GetGeneralParameterValue("EmailSMTP Sitio");
                    email.To = aux.GetGeneralParameterValue("EmailSMTP Sitio");
                    email.subject = "Contacto - Web Site";
                    email.SMTPClient = aux.GetGeneralParameterValue("SMTP Client");
                    email.SMTPPort = Convert.ToInt32(aux.GetGeneralParameterValue("SMTP Port"));

                    email.Message = String.Concat(GetHtmlTemplate(txtNombre.Text,txtEmail.Text,txtTelefono.Text,txtDetalle.Value));

                    this.sendEmail(email);

                    this.divContenido.Visible = false;
                    this.divContentMessage.Visible = true;
                }
            }
            catch (Exception ex)
            {
                this.divContenido.Visible = false;
                this.lblError.InnerText = ex.Message;
            }
        }