public void enviarCorreo(string clienteSocio,string emailSocio)
    {
        string datos = ConvertToHtmlFile();
        string msg = "";
        string script = "";
        try
        {
            Correos Cr = new Correos();
            System.Net.Mail.MailMessage mnsj = new MailMessage();
            mnsj.Subject = "Comprobante de Pago de Cuenta FacilitoOnline";
            string email = emailSocio;
            mnsj.To.Add(new MailAddress(email));
            mnsj.From = new MailAddress("*****@*****.**", "Administrador");
            string ruta = HttpContext.Current.Request.MapPath("~/img/iconos/gracias.gif");
            mnsj.Attachments.Add(new Attachment(ruta));
            mnsj.Body = "AVISO DE VENCIMIENTO - FACILITOONLINE \n\n\n" + "Estimado(a) Socio(a) :" + clienteSocio + "\n" + datos;
            mnsj.IsBodyHtml = true;
            Cr.MandarCorreo(mnsj);
            msg = "La Factura mensual ha sido enviada a los socios correctamente" + " Listo!!";
        }
        catch (Exception ex)
        {
            msg = ex.Message;

        }
        script = @"<script type='text/javascript'> alert('{0}'); </script>";
        script = string.Format(script, msg);
        ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
        btnEnviarATodos.Enabled = false;
    }
Beispiel #2
0
    private void enviarCorreo(DataMedico med)
    {
        try
        {
            // Instanciamos la clase Correo
            Correos correo = new Correos();
            // Iniciallizamos el mensaje del correo electrónico
            MailMessage mnsj = new MailMessage();
            // Establecemos el Asunto
            mnsj.Subject = "¡Hola! Gracias por suscribirse. Revisaremos su solictud";
            // Aqui el Correo de destino
            string email = med.Email_med;
            mnsj.To.Add(new MailAddress(email));
            // Aqui el Correo de origen
            mnsj.From = new MailAddress("*****@*****.**", "CuidateYa");
            // Aquí si desea adjuntar algún archivo

            /*string ruta = HttpContext.Current.Request.MapPath("~/App/Images/check.png");
             * mnsj.Attachments.Add(new Attachment(ruta));*/
            // Aqui el contenido del mensaje
            mnsj.Body       = plantillaMedico(med);
            mnsj.IsBodyHtml = true;
            // Enviamos el correo
            correo.MandarCorreo(mnsj);
            lblMensaje.Text = "El correo se ha enviado correctamente";
        }
        catch (Exception ex)
        {
            lblMensaje.Text = "Ocurrio un error al intentar enviar el correo: " + ex.Message;
        }
    }
Beispiel #3
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            try
            {
                td.Insert(Convert.ToInt32(grdYourTickets.SelectedRow.Cells[1].Text), DateTime.Now, 2, txtAnswer.InnerText);
                grdYourTicketDetails.DataBind();
                Correos     Cr    = new Correos();
                var         Email = Convert.ToString(grdYourTickets.SelectedRow.Cells[4].Text);
                MailMessage mnsj  = new MailMessage();

                mnsj.Subject = "Sistema de Iscripción de Becas";

                mnsj.To.Add(new MailAddress(Email.ToString()));

                mnsj.From = new MailAddress("*****@*****.**", "UJComputers");

                mnsj.Body = " UJComputers\n Support Center  \n Hi " + Convert.ToString(grdYourTickets.SelectedRow.Cells[3].Text) + ". \n Your problem has been answered by one of our supporters. \n\n Please visit our page with your code you will see the answers yo your problem.\n\n Have a good day.";


                /* Enviar */
                Cr.MandarCorreo(mnsj);
                txtAnswer.InnerText = "";
            }

            catch
            {
                System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('Error sending the message, please try again');", true);
            }
        }
Beispiel #4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                Tickets.Insert(DateTime.Now, Convert.ToInt32(ddlTopic.SelectedValue.ToString()), Convert.ToInt32(ddlPriority.SelectedValue.ToString()), txtName.Text, txtEmail.Text, txtPhone.Text, txtCompany.Text, txtSummary.Text, TxtDetails.InnerText, 0, 1);
                var LastID = Tickets.MaxID();
                td.Insert((int)LastID, DateTime.Now, 0, "Your problem is going to be resolved in the next few hours");
                System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('Ticket created successfully. Your ticket ID has been sent to your Email');", true);
                Correos     Cr   = new Correos();
                MailMessage mnsj = new MailMessage();

                mnsj.Subject = "UJComputers Support Center";

                mnsj.To.Add(new MailAddress(txtEmail.Text));

                mnsj.From = new MailAddress("*****@*****.**", "UJComputers");

                mnsj.Body = " UJComputers\n Support Center  \n Thanks " + txtName.Text + " for using the Ticket Support Center. \n Your problem will be solved in the next 24 hours  \n Here is your ticket ID, you can use your ticket status in our Support Center Ticket Status page.\n\n Your Ticket ID is: " + LastID.ToString() + "\n Have a good day.";

                /* Enviar */
                Cr.MandarCorreo(mnsj);
                lblCorreo.Text = "Correo Enviado";
                txtName.Text   = "";
                txtName.Text   = "";
                txtName.Text   = "";
                txtName.Text   = "";
                txtName.Text   = "";
            }
            catch
            {
                System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('Error Creating your ticket ');", true);
            }
        }
Beispiel #5
0
        protected void btnCorreo_Click(object sender, EventArgs e)
        {
            ac.conectar();
            string correo       = this.txtCorreo.Text;
            Random rm           = new Random();
            int    numConfirm   = rm.Next(100000, 999999);
            bool   existeCorreo = CorreoExistente();

            if (existeCorreo)
            {
                try
                {
                    Correos     cr   = new Correos();
                    MailMessage mnsj = new MailMessage();

                    mnsj.Subject = "Reestablecer contrasena";

                    mnsj.To.Add(new MailAddress(this.txtCorreo.Text));

                    mnsj.From = new MailAddress("*****@*****.**", "Fede Buroni");

                    /* Si deseamos Adjuntar algún archivo
                     * mnsj.Attachments.Add(new Attachment("C:\\archivo.pdf"));*/

                    mnsj.Body = "  Su numero de confirmacion es:" + numConfirm;

                    /* Enviar */
                    cr.MandarCorreo(mnsj);
                    string update = "update Usuarios set codpass='******' where email='" + correo + "'";

                    SqlCommand comandoUpdate = new SqlCommand(update, ac.conexion);
                    comandoUpdate.ExecuteNonQuery();
                    comandoUpdate.Dispose();
                    lblCorreoMandado.Visible             = true;
                    this.lblCorreoMandado.Text           = "Revise su casilla de correo electronico";
                    this.txtCorreo.ReadOnly              = true;
                    this.Panel1.Visible                  = true;
                    this.Panel1.Enabled                  = true;
                    this.RequiredFieldValidator1.Enabled = true;
                    this.RequiredFieldValidator2.Enabled = true;
                    this.RequiredFieldValidator3.Enabled = true;
                    this.btnEnviar.Visible               = true;
                    this.lblErrorCorreo.Visible          = false;
                }
                catch (Exception ex)
                {
                    lblErrorCorreo.Text = "El correo electronico no es correcto" + ex.Message;
                }
            }
            else
            {
                lblErrorCorreo.Text      = "El correo ingresado no existe";
                lblCorreoMandado.Visible = false;
            }

            ac.cerrarConexion();
        }
    private void EnviarCorreo(string correo,string fecha,string usuario)
    {
        string datos = ConvertToHtmlFile(correo,fecha,usuario);

        string msg1="ssss";
        try
        {
            Correos Cr = new Correos();
            //Inicializar mensaje de correo
            MailMessage MM = new MailMessage();
            //Establecemso el asunto
            MM.Subject = "Confirmacion de cuenta FacilOnline";
            //Correo de destimo
            string email = correo;
            MM.To.Add(new MailAddress(email));
            //Aki correo d origen
            MM.From = new MailAddress("*****@*****.**", "Administrador");

            //Ajuntar algun archivo
            //string ruta = HttpContext.Current.Request.MapPath("~/imagen/rrohan.jpg");
            //MM.Attachments.Add(new Attachment(ruta));
            //el contenido del mensaje
            MM.Body = datos;
            MM.IsBodyHtml = true;
            // Enviar
            Cr.MandarCorreo(MM);
            //Enviado = true;

            //Mostrar mensaje
            string msg2 = "El Mail se ha Enviado a su correo electronico Correctamente" + " Listo!!";
            string script = @"<script type='text/javascript'> alert('{0}'); </script>";
            script = string.Format(script, msg2);
            ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);

        }
        catch (Exception ex)
        {

            msg1 = ex.Message;
            string script = @"<script type='text/javascript'> alert('{0}'); </script>";
            script = string.Format(script, msg1);
            ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
        }
    }
Beispiel #7
0
        private void button2_Click(object sender, EventArgs e)
        {
            using (new CursorWait()) {
                try
                {
                    /*Tools.SendMail oMail = new Tools.SendMail(Tools.TYPE_EMAIL_SERVER.HOTMAIL);
                     * String[] config = ConfigurationManager.AppSettings["Hotmail"].ToString().Split(';');
                     * oMail.mUser = config[0];
                     * oMail.mPassword = config[1];
                     *
                     * oMail.mFrom = config[0];
                     * oMail.mTo = "*****@*****.**";
                     * oMail.mSubject = "REPORTE-" + System.DateTime.Now.ToString("MMddyy");
                     * oMail.mTextBody = DataGridtoHTML(this.grdDatos).ToString();
                     * if (oMail.send())
                     * {
                     *  MessageBox.Show("Información Enviada", "Sistema de reportes", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     * }
                     * else
                     * {
                     *  MessageBox.Show("Se presento un error, información no se envio", "Sistema de reportes", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     * }*/
                    bool outlook = Convert.ToBoolean(ConfigurationManager.AppSettings["Outlook"]);
                    if (outlook)
                    {
                        bool bRes = Correos.sendEmailViaOutlook(
                            "*****@*****.**",
                            ConfigurationManager.AppSettings["EmailAdmin"].ToString(), null,
                            this.cmbAlmacenes.Text + "-" + System.DateTime.Now.ToString("MMddyy"),
                            "My message body - " + DateTime.Now.ToString(),
                            BodyType.PlainText,
                            null,
                            null);
                    }
                    else
                    {
                        String[]    config = ConfigurationManager.AppSettings["Hotmail"].ToString().Split(';');
                        Correos     cr     = new Correos(config[0], config[1]);
                        MailMessage msaje  = new MailMessage();
                        msaje.Subject = "REPORTE-" + System.DateTime.Now.ToString("MMddyy");
                        msaje.To.Add(new MailAddress(ConfigurationManager.AppSettings["EmailAdmin"].ToString()));
                        msaje.From = new MailAddress(config[0], "Sistema de Gestion de Reportes");
                        //si quieres atach
                        //msaje.Attachments.Add(new Attachment("c:\\archivo.pdf"));

                        msaje.Body       = DataGridtoHTML(this.grdDatos).ToString();
                        msaje.IsBodyHtml = true;
                        cr.MandarCorreo(msaje);
                    }
                    MessageBox.Show("Información enviada");
                }
                catch (Exception ex)
                {
                    Reportes.Tools.ELog.save("ENVIO DE CORREO", ex);
                    if (ex.InnerException != null)
                    {
                        Reportes.Tools.ELog.save("ENVIO DE CORREO", ex.InnerException);
                    }
                }
            }
        }
        private void Email(object sender, RoutedEventArgs e)
        {
            try
            {
                Correos Cr = new Correos();
                MailMessage mnsj = new MailMessage();
                mnsj.Subject = "Hola Mundo Prueba";
                mnsj.To.Add(new MailAddress("*****@*****.**"));
                mnsj.From = new MailAddress("*****@*****.**", "Eder Bollas Tovar");
                /* Si deseamos Adjuntar algún archivo*/
                //mnsj.Attachments.Add(new Attachment("E:\\LINEAMIENTOS.pdf"));
                mnsj.Body = "Pinche nahayote de shit";

                /* Enviar */

                Cr.MandarCorreo(mnsj);

                //Enviado = true;
                MessageBox.Show("El Mail se ha Enviado Correctamente", "Listo!!",MessageBoxButton.OK);//, System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Asterisk);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #9
0
        protected void btnRegistrar_Click2(object sender, EventArgs e)
        {
            es.ehusw.Matriculas m = new es.ehusw.Matriculas();
            if (m.comprobar(txtDirCorreo.Text) == "SI")

            {
                lblCorreoInexistente.Enabled = false;
                bool       enviado         = false;
                Random     rm              = new Random();
                int        numConfirm      = rm.Next(1000000, 9999999);
                bool       correoExistente = false;
                string     select          = "select * from Usuarios where email=@correo";
                SqlCommand comando1        = new SqlCommand(select, ac.conexion);
                comando1.Parameters.AddWithValue("@correo", txtDirCorreo.Text);

                SqlDataReader dr = comando1.ExecuteReader();
                dr.Read();
                if (dr.HasRows)
                {
                    correoExistente = true;
                }
                dr.Close();
                comando1.Dispose();
                if (!correoExistente)
                {
                    try
                    {
                        Correos     cr   = new Correos();
                        MailMessage mnsj = new MailMessage();

                        mnsj.Subject = "Confirmacion de correo electronico";

                        mnsj.To.Add(new MailAddress(txtDirCorreo.Text));

                        mnsj.From = new MailAddress("*****@*****.**", "Fede Buroni");


                        mnsj.Body = "  Mensaje de Prueba \n\n Enviado desde C#\n\n http://hads18-fede.azurewebsites.net//Confirmar.aspx?correo=" + txtDirCorreo.Text + "&numconf=" + numConfirm;

                        /* Enviar */
                        cr.MandarCorreo(mnsj);
                        enviado            = true;
                        lblconfirmail.Text = "El Mail se ha Enviado Correctamente";
                    }
                    catch (Exception ex)
                    {
                        lblconfirmail.Text = ex.Message;
                        enviado            = false;
                    }
                    if (enviado)
                    {
                        int    confirm = 0;
                        int    codPass = 0;
                        string insert  = "INSERT INTO Usuarios(email,nombre,apellidos,numconfir,confirmado,tipo,pass,codpass) VALUES (@email,@nombre,@apellidos,@numconfir,@confirmado,@tipo,@pass,@codpass)";

                        SqlCommand comando = new SqlCommand(insert, ac.conexion);

                        try
                        {
                            comando.Parameters.AddWithValue("@email", this.txtDirCorreo.Text);
                            comando.Parameters.AddWithValue("@nombre", this.txtNom.Text);
                            comando.Parameters.AddWithValue("@apellidos", this.txtApe.Text);
                            comando.Parameters.AddWithValue("@numconfir", numConfirm);
                            comando.Parameters.AddWithValue("@confirmado", confirm);
                            comando.Parameters.AddWithValue("@tipo", RadioButtonList1.SelectedItem.Text);
                            comando.Parameters.AddWithValue("@pass", EncriptarMD5.MD5Hash(this.txtPassword1.Text));
                            comando.Parameters.AddWithValue("@codpass", codPass);

                            int numregs = comando.ExecuteNonQuery();
                            lblConfir.Text = numregs + " registro insertado correctamente." + "<br/>" + "" + "<br/>" + " Puede confirmarlo con el correo mandado a su email, o con el link:  <a href =\"http://hads18-fede.azurewebsites.net/Confirmar.aspx?correo=" + txtDirCorreo.Text + "&numconf=" + numConfirm + "\">Validar Correo</a>" + "<br/>" + "" + "<br/>" + "";
                            ac.cerrarConexion();
                            lblCorreoInexistente.Visible = false;
                        }
                        catch (Exception ex)
                        {
                            lblConfir.Text = ex.Message;
                        }
                    }
                    else
                    {
                        lblCorreoInexistente.Text         = "El correo ingresado no existe pero es vip";
                        this.lblCorreoInexistente.Visible = true;
                    }
                }
                else
                {
                    lblCorreoInexistente.Text    = "El correo ingresado ya existe";
                    lblCorreoInexistente.Visible = true;
                }
            }

            else
            {
                lblCorreoInexistente.Text    = "El correo ingresado no es vip";
                lblCorreoInexistente.Visible = true;
            }
        }
    protected void btnRegistrar_Click(object sender, EventArgs e)
    {
        string datos = ConvertToHtmlFile();

        DataUsuario du = new DataUsuario();

        du.Email = txtEmail.Text;
        du.Clave = txtClave.Text;
        du.Nombres = txtNombres.Text;
        du.Apellidos = txtApellidos.Text;
        du.Direccion = txtDireccion.Text;
        du.FechaDeNacimiento = DateTime.Parse(txtFechaDeNacimiento.Text);
        du.TipoDeUsuario = int.Parse(cboTipoCliente.SelectedValue);

        string msg1 = u.registrarUsuario(du);

        // Enviar correo
        try
        {
            // Instanciar Correos
            Correos Cr = new Correos();
            // Iniciallizar el msg de correo electrónico
            MailMessage mnsj = new MailMessage();
            // Establecemos el Asunto
            mnsj.Subject = "Confirmación de Cuenta FacilitoOnline";
            // Aqui el Correo de destino
            string email = txtEmail.Text;
            mnsj.To.Add(new MailAddress(email));
            // Aqui el Correo de origen
            mnsj.From = new MailAddress("*****@*****.**", "Administrador");
            // Adjuntar algún archivo
            string ruta = HttpContext.Current.Request.MapPath("~/img/iconos/gracias.gif");
            mnsj.Attachments.Add(new Attachment(ruta));
            // El contenido del mensaje
            mnsj.Body = datos;
            mnsj.IsBodyHtml = true;
            // Enviar
            Cr.MandarCorreo(mnsj);
            Enviado = true;
            // Mostrar mensaje
            /*string msg2 = "El Mail se ha Enviado a su correo electronico Correctamente" + " Listo!!";
            string script = @"<script type='text/javascript'> alert('{0}'); </script>";
            script = string.Format(script, msg2);
            ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);*/

            // Mostrar mensaje y retornar
            string script = @"<script type='text/javascript'>
                                    alert('El Mail se ha Enviado a su correo electrónico Correctamente. Listo!!');
                                    window.location = 'Restaurantes.aspx';
                              </script>";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
        }
        catch (Exception ex)
        {
            msg1 = ex.Message;
            string script = @"<script type='text/javascript'> alert('{0}'); </script>";
            script = string.Format(script, msg1);
            ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
        }

        lblMensaje.Text = msg1;
        btnRegistrar.Enabled = false;
    }
    protected void btnRegistrar_Click(object sender, EventArgs e)
    {
        string datos = ConvertToHtmlFile();

        DataCliente cli = new DataCliente();

        string[] correos = { "@hotmail.com", "@live.com", "@gmail.com" };
        usuario = txtEmail.Text;
        clave = txtEmail.Text;
        foreach (string correo in correos)
        {
            usuario = usuario.Replace(correo, "@facilito.com");
            clave = clave.Replace(correo, "");
        }

        cli.Membresia = usuario;
        cli.Clave = clave;

        cli.Contacto = txtContacto.Text;
        cli.Email = txtEmail.Text;
        cli.Cargo = int.Parse(cboCargo.SelectedValue);
        cli.RazonSocial = txtRazonSocial.Text;
        cli.Calle = txtCalle.Text;
        cli.NumeroExterior = txtNumeroExterior.Text;
        cli.NumeroInterior = txtNumeroInterior.Text;
        cli.Municipio = txtMunicipio.Text;
        cli.CodigoPostal = txtCodigoPostal.Text;
        cli.Ciudad = txtCiudad.Text;
        cli.Pais = cboPais.SelectedValue;
        cli.Estado = int.Parse(cboEstado.SelectedValue);
        cli.SitioWeb = txtSitioWeb.Text;
        cli.ActividadPreponderante = txtActividadPreponderante.Text;
        cli.ListadoProductos = txtListarProductos.Text;
        cli.TipoCliente = int.Parse(cboTipoCliente.SelectedValue);

        string msg1 = c.registrarCliente(cli);

        // Enviar correo
        try
        {
            // Instanciar Correos
            Correos Cr = new Correos();
            // Iniciallizar el msg de correo electrónico
            MailMessage mnsj = new MailMessage();
            // Establecemos el Asunto
            mnsj.Subject = "Confirmación de Cuenta FacilitoOnline";
            // Aqui el Correo de destino
            string email = txtEmail.Text;
            mnsj.To.Add(new MailAddress(email));
            // Aqui el Correo de origen
            mnsj.From = new MailAddress("*****@*****.**", "Administrador");
            // Adjuntar algún archivo
            string ruta = HttpContext.Current.Request.MapPath("~/img/iconos/gracias.gif");
            mnsj.Attachments.Add(new Attachment(ruta));
            // El contenido del mensaje
            mnsj.Body = datos;
            mnsj.IsBodyHtml = true;
            // Enviar
            Cr.MandarCorreo(mnsj);
            Enviado = true;
            // Mostrar mensaje y retornar
            string script = @"<script type='text/javascript'>
                                    alert('El Mail se ha Enviado a su correo electrónico Correctamente. Listo!!');
                                    window.location = 'Restaurantes.aspx';
                              </script>";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false) ;
        }
        catch (Exception ex)
        {
            msg1 = ex.Message;
            string script = @"<script type='text/javascript'> alert('{0}'); </script>";
            script = string.Format(script, msg1);
            ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
        }

        lblMensaje.Text = msg1;
        btnRegistrar.Enabled = false;
    }