Example #1
0
 private void VerificarConfigEmailAtiva()
 {
     if (_EmailAtivo == string.Empty || _EmailAtivo == null)
     {
         _AlterarCad           = false;
         btnEmailTeste.Enabled = false;
         MessageBox.Show("Atenção você irá configurar pela primeira vez a conta de email do sistema!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtEmail.Focus();
     }
     else
     {
         _AlterarCad        = true;
         txtEmail.Text      = c_emailConfig.GetSMTpEmail();
         txtHostSMTP.Text   = c_emailConfig.GetSMTPHost();
         txtPortaSMTP.Text  = c_emailConfig.GetSMTPPorta();
         txtSenhaEmail.Text = c_emailConfig.GetSMTPSenhaEmail();
         if (c_emailConfig.GetSMTPCredencialPadrao() == true)
         {
             cbxCredencialPadrao.Checked = true;
         }
         else if (c_emailConfig.GetSMTPCredencialPadrao() == false)
         {
             cbxCredencialPadrao.Checked = false;
         }
         if (c_emailConfig.GetSMTPSSL() == true)
         {
             cbxSSL.Checked = true;
         }
         else if (c_emailConfig.GetSMTPSSL() == false)
         {
             cbxSSL.Checked = false;
         }
         btnEmailTeste.Enabled = true;
     }
 }
Example #2
0
        private async void bbiEmailAvisoPendencia_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int    IdCorretor = Convert.ToInt32(gdvPendencias.GetRowCellValue(gdvPendencias.GetSelectedRows()[0], gdvPendencias.Columns[3]));
            string Loteamento = gdvPendencias.GetRowCellValue(gdvPendencias.GetSelectedRows()[0], gdvPendencias.Columns[2]).ToString();
            string Corretor   = gdvPendencias.GetRowCellValue(gdvPendencias.GetSelectedRows()[0], gdvPendencias.Columns[4]).ToString();
            string Qd         = gdvPendencias.GetRowCellValue(gdvPendencias.GetSelectedRows()[0], gdvPendencias.Columns[5]).ToString();
            string Lt         = gdvPendencias.GetRowCellValue(gdvPendencias.GetSelectedRows()[0], gdvPendencias.Columns[6]).ToString();
            string Pendencia  = gdvPendencias.GetRowCellValue(gdvPendencias.GetSelectedRows()[0], gdvPendencias.Columns[10]).ToString();
            string Cliente    = gdvPendencias.GetRowCellValue(gdvPendencias.GetSelectedRows()[0], gdvPendencias.Columns[7]).ToString();
            string DataVenda  = gdvPendencias.GetRowCellValue(gdvPendencias.GetSelectedRows()[0], gdvPendencias.Columns[12]).ToString().Replace("00:00:00", "");
            string Venda      = gdvPendencias.GetRowCellValue(gdvPendencias.GetSelectedRows()[0], gdvPendencias.Columns[8]).ToString();

            try
            {
                if (gdvPendencias.SelectedRowsCount == 1 && (int)gdvPendencias.GetRowCellValue(gdvPendencias.GetSelectedRows()[0], gdvPendencias.Columns[11]) == 0)
                {
                    using (System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient())
                    {
                        m_corretor.idcorretor              = Convert.ToInt32(IdCorretor);
                        m_corretor.email                   = c_corretor.GetEmailCorretor(m_corretor);
                        m_emailConfig.smtpemail            = c_emailConfig.GetSMTpEmail();
                        m_emailConfig.smtphost             = c_emailConfig.GetSMTPHost();
                        m_emailConfig.smtpporta            = Convert.ToInt32(c_emailConfig.GetSMTPPorta());
                        m_emailConfig.smtpsenhaemail       = c_emailConfig.GetSMTPSenhaEmail();
                        m_emailConfig.smtpssl              = c_emailConfig.GetSMTPSSL();
                        m_emailConfig.smtpcredencialpadrao = c_emailConfig.GetSMTPCredencialPadrao();

                        smtp.Host                  = m_emailConfig.smtphost;             //"smtp.gmail.com"
                        smtp.Port                  = m_emailConfig.smtpporta;            //587
                        smtp.EnableSsl             = m_emailConfig.smtpssl;              //true
                        smtp.UseDefaultCredentials = m_emailConfig.smtpcredencialpadrao; //false
                        smtp.Credentials           = new System.Net.NetworkCredential(m_emailConfig.smtpemail, m_emailConfig.smtpsenhaemail);

                        using (System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage())
                        {
                            mail.From = new System.Net.Mail.MailAddress(m_emailConfig.smtpemail); //Conta de email que vai usar

                            if (!string.IsNullOrWhiteSpace(m_corretor.email))                     //Email para enviar
                            {
                                mail.To.Add(new System.Net.Mail.MailAddress(m_corretor.email));   //Email para enviar
                            }
                            else
                            {
                                //splashScreenManager1.CloseWaitForm();
                                MessageBox.Show("Não foi encontrado E-mail para envio!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }

                            /*if (cbxEnviarCopiarEmailAviso.Checked == true)
                             *  mail.CC.Add(new System.Net.Mail.MailAddress(m_emailConfig.smtpemail));
                             * if (!string.IsNullOrWhiteSpace(textBoxCCo.Text))
                             *  mail.Bcc.Add(new System.Net.Mail.MailAddress(textBoxCCo.Text));*/
                            mail.IsBodyHtml = true;
                            mail.Subject    = "Aviso Contrato Pendênte Prime/Valle!  Venda:(" + Venda + ")";//Assunto do email

                            var EmailHtml =
                                @"<h2 style=""text - align: center; ""><span style=""color: #ff0000;""><strong>Aviso de Contrato com Pend&ecirc;ncia <img src=""https://html-online.com/editor/tinymce4_6_5/plugins/emoticons/img/smiley-frown.gif"" alt=""frown"" /><br /></strong></span></h2>" +
                                @"<hr />" +
                                @"<p style=""text - align: center; ""><span style=""text - decoration: underline; ""><span style=""color: #000000;""><strong>Dados da Venda:</strong></span></span></p>" +
                                @"<ul>" +
                                @"<li style=""text - align: left; ""><span style=""color: #000000;""><strong>Empreendimento: </strong><span style=""color: #008000;"">" + Loteamento + "</span><br /></span></li>" +
                                @"<li style=""text - align: left; ""><span style=""color: #000000;""><strong>Quadra:</strong> <span style=""color: #008000;"">" + Qd + "</span> <strong>Lote:</strong>" +
                                @"<span style=""color: #008000;"">" + Lt + "</span></span></li>" +
                                @"<li style=""text - align: left; ""><span style=""color: #000000;""><strong>Corretor:</strong> <span style=""color: #008000;"">" + Corretor + "</span></span></li>" +
                                @"<li style=""text - align: left; ""><span style=""color: #000000;""><strong>Cliente:</strong> <span style=""color: #008000;"">" + Cliente + "</span></span></li>" +
                                @"<li style=""text - align: left; ""><span style=""color: #000000;""><strong>Data Venda:</strong> <span style=""color: #008000;"">" + DataVenda + "</span></span></li>" +
                                @"<li style=""text - align: left; ""><span style=""color: #000000;""><strong>Pend&ecirc;ncia:</strong> <span style=""color: #008000;"">" + Pendencia + "</span></span></li>" +
                                @"</ul>" +
                                @"<p style=""text - align: left; "">&nbsp;</p>" +
                                @"<p style=""text - align: left; ""><span style=""color: #000000;""><strong>OBS:</strong> Procure o escr&iacute;torio o mais r&aacute;pido poss&iacute;vel para resolver sua pend&ecirc;ncia e evitar que o pagamento da sua comiss&atilde;o seja <strong><span style=""color: #ff0000;"">bloqueada!</span></strong></span></p>" +
                                @"<hr />" +
                                @"<p><span style=""color: #0000ff;""><span style=""color: #000000;"">&copy;2018 -</span> <strong><span style=""color: #0000ff;"">Viva Bem, Viva Valle...</span></strong></span></p>" +
                                @"<p style=""text - align: left; "">&nbsp;</p>";
                            mail.Body = EmailHtml;
                            await smtp.SendMailAsync(mail);

                            MessageBox.Show("E-mail Enviado com sucesso para:" + m_corretor.email + " sobre a pendência do corretor(a):" + Corretor, "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Tipo de aviso somente para contratos com Pendência com status = A - Resolver", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex.Message, "SGS", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
        private async void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtCliente.Text != string.Empty && txtPendencia.Text != string.Empty && txtQuadra.Text != string.Empty && txtLote.Text != string.Empty && LookUpEditCorretor.Text != string.Empty && LookUpEditLoteamento.Text != string.Empty)
                {
                    if (MessageBox.Show("Deseja salvar ?", "SGS", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        m_pendencias.nomecliente              = txtCliente.Text;
                        m_pendencias.quadra                   = txtQuadra.Text;
                        m_pendencias.lote                     = txtLote.Text;
                        m_pendencias.numerocontrato           = txtNumeroContrato.Text;
                        m_pendencias.pendencia                = txtPendencia.Text;
                        m_pendencias.datacadastro             = Convert.ToDateTime(dtpDataCad.Value.ToShortDateString());
                        m_pendencias.datavenda                = Convert.ToDateTime(dtpDataVenda.Value.ToShortDateString());
                        m_pendencias.datacadpendencia         = Convert.ToDateTime(dteDataCadPendencia.Text);
                        m_pendencias.venda                    = txtVenda.Text;
                        m_pendencias.fk_corretor_pendencias   = (int)LookUpEditCorretor.EditValue;
                        m_pendencias.fk_loteamento_pendencias = (int)LookUpEditLoteamento.EditValue;
                        //Status pendencia 0 = corretor, 1 = resolvido.

                        if (cbxAvisarCorretorPendencia.Checked == true)
                        {
                            splashScreenManagerP.ShowWaitForm();
                            DesativaTela();

                            using (System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient())
                            {
                                m_corretor.idcorretor              = Convert.ToInt32(LookUpEditCorretor.EditValue);
                                m_corretor.email                   = c_corretor.GetEmailCorretor(m_corretor);
                                m_emailConfig.smtpemail            = c_emailConfig.GetSMTpEmail();
                                m_emailConfig.smtphost             = c_emailConfig.GetSMTPHost();
                                m_emailConfig.smtpporta            = Convert.ToInt32(c_emailConfig.GetSMTPPorta());
                                m_emailConfig.smtpsenhaemail       = c_emailConfig.GetSMTPSenhaEmail();
                                m_emailConfig.smtpssl              = c_emailConfig.GetSMTPSSL();
                                m_emailConfig.smtpcredencialpadrao = c_emailConfig.GetSMTPCredencialPadrao();

                                smtp.Host                  = m_emailConfig.smtphost;             //"smtp.gmail.com"
                                smtp.Port                  = m_emailConfig.smtpporta;            //587
                                smtp.EnableSsl             = m_emailConfig.smtpssl;              //true
                                smtp.UseDefaultCredentials = m_emailConfig.smtpcredencialpadrao; //false
                                smtp.Credentials           = new System.Net.NetworkCredential(m_emailConfig.smtpemail, m_emailConfig.smtpsenhaemail);

                                using (System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage())
                                {
                                    mail.From = new System.Net.Mail.MailAddress(m_emailConfig.smtpemail); //Conta de email que vai usar

                                    if (!string.IsNullOrWhiteSpace(m_corretor.email))                     //Email para enviar
                                    {
                                        mail.To.Add(new System.Net.Mail.MailAddress(m_corretor.email));   //Email para enviar
                                    }
                                    else
                                    {
                                        AtivaTela();
                                        splashScreenManagerP.CloseWaitForm();

                                        MessageBox.Show("Não foi encontrado E-mail para envio!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        return;
                                    }
                                    if (cbxEnviarCopiarEmailAviso.Checked == true)
                                    {
                                        mail.CC.Add(new System.Net.Mail.MailAddress(m_emailConfig.smtpemail));
                                    }

                                    /*if (!string.IsNullOrWhiteSpace(textBoxCCo.Text))
                                     *  mail.Bcc.Add(new System.Net.Mail.MailAddress(textBoxCCo.Text));*/
                                    mail.IsBodyHtml = true;
                                    mail.Subject    = "Aviso Contrato Pendênte Prime/Valle!  Venda:(" + txtVenda.Text + ")";//Assunto do email

                                    var EmailHtml =
                                        @"<h2 style=""text - align: center; ""><span style=""color: #ff0000;""><strong>Aviso de Contrato com Pend&ecirc;ncia <img src=""https://html-online.com/editor/tinymce4_6_5/plugins/emoticons/img/smiley-frown.gif"" alt=""frown"" /><br /></strong></span></h2>" +
                                        @"<hr />" +
                                        @"<p style=""text - align: center; ""><span style=""text - decoration: underline; ""><span style=""color: #000000;""><strong>Dados da Venda:</strong></span></span></p>" +
                                        @"<ul>" +
                                        @"<li style=""text - align: left; ""><span style=""color: #000000;""><strong>Empreendimento: </strong><span style=""color: #008000;"">" + LookUpEditLoteamento.Text + "</span><br /></span></li>" +
                                        @"<li style=""text - align: left; ""><span style=""color: #000000;""><strong>Quadra:</strong> <span style=""color: #008000;"">" + txtQuadra.Text + "</span> <strong>Lote:</strong>" +
                                        @"<span style=""color: #008000;"">" + txtLote.Text + "</span></span></li>" +
                                        @"<li style=""text - align: left; ""><span style=""color: #000000;""><strong>Corretor:</strong> <span style=""color: #008000;"">" + LookUpEditCorretor.Text + "</span></span></li>" +
                                        @"<li style=""text - align: left; ""><span style=""color: #000000;""><strong>Cliente:</strong> <span style=""color: #008000;"">" + txtCliente.Text + "</span></span></li>" +
                                        @"<li style=""text - align: left; ""><span style=""color: #000000;""><strong>Data Venda:</strong> <span style=""color: #008000;"">" + dtpDataVenda.Text + "</span></span></li>" +
                                        @"<li style=""text - align: left; ""><span style=""color: #000000;""><strong>Pend&ecirc;ncia:</strong> <span style=""color: #008000;"">" + txtPendencia.Text + "</span></span></li>" +
                                        @"</ul>" +
                                        @"<p style=""text - align: left; "">&nbsp;</p>" +
                                        @"<p style=""text - align: left; ""><span style=""color: #000000;""><strong>OBS:</strong> Procure o escr&iacute;torio o mais r&aacute;pido poss&iacute;vel para resolver sua pend&ecirc;ncia e evitar que o pagamento da sua comiss&atilde;o seja <strong><span style=""color: #ff0000;"">bloqueada!</span></strong></span></p>" +
                                        @"<hr />" +
                                        @"<p><span style=""color: #0000ff;""><span style=""color: #000000;"">&copy;2018 -</span> <strong><span style=""color: #0000ff;"">Viva Bem, Viva Valle...</span></strong></span></p>" +
                                        @"<p style=""text - align: left; "">&nbsp;</p>";
                                    mail.Body = EmailHtml;
                                    await smtp.SendMailAsync(mail);

                                    //MessageBox.Show("Enviado com sucesso!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    splashScreenManagerP.CloseWaitForm();
                                }
                            }
                        }

                        if (_alterarCad == true)
                        {
                            m_pendencias.status = (int)e_StatusPendencia.A_Resolver;
                            c_pendencias.AlterarPendencias(m_pendencias);
                            MessageBox.Show("Pendência Alterada com sucesso!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            AtualizarGrid();
                            this.Close();
                        }
                        else if (_alterarCad == false)
                        {
                            c_pendencias.NovoPendencias(m_pendencias);
                            MessageBox.Show("Nova Pendência Salva com sucesso!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            AtualizarGrid();
                            this.Close();
                        }
                    }
                }

                else
                {
                    MessageBox.Show("Verifique se todos os campos foram preenchidos!...", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex.Message, "SGS", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        private async void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                if (cbxCorretor.Text != string.Empty && cbxEmpreendimento.Text != string.Empty && cbxFolha.Text != string.Empty || rbtPGAprazo.Checked == true || rbtPGAvista.Checked == true)
                {
                    if (MessageBox.Show("Deseja Salvar a distribuição?", "SGS", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (cbxNotificarCorretorEmail.Checked == true)
                        {
                            splashScreenManagerP.ShowWaitForm();
                            DesativarForm();
                            try
                            {
                                using (System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient())
                                {
                                    m_corretor.idcorretor              = Convert.ToInt32(cbxCorretor.EditValue);
                                    m_corretor.email                   = c_corretor.GetEmailCorretor(m_corretor);
                                    m_emailConfig.smtpemail            = c_emailConfig.GetSMTpEmail();
                                    m_emailConfig.smtphost             = c_emailConfig.GetSMTPHost();
                                    m_emailConfig.smtpporta            = Convert.ToInt32(c_emailConfig.GetSMTPPorta());
                                    m_emailConfig.smtpsenhaemail       = c_emailConfig.GetSMTPSenhaEmail();
                                    m_emailConfig.smtpssl              = c_emailConfig.GetSMTPSSL();
                                    m_emailConfig.smtpcredencialpadrao = c_emailConfig.GetSMTPCredencialPadrao();

                                    smtp.Host                  = m_emailConfig.smtphost;             //"smtp.gmail.com"
                                    smtp.Port                  = m_emailConfig.smtpporta;            //587
                                    smtp.EnableSsl             = m_emailConfig.smtpssl;              //true
                                    smtp.UseDefaultCredentials = m_emailConfig.smtpcredencialpadrao; //false
                                    smtp.Credentials           = new System.Net.NetworkCredential(m_emailConfig.smtpemail, m_emailConfig.smtpsenhaemail);

                                    using (System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage())
                                    {
                                        mail.From = new System.Net.Mail.MailAddress(m_emailConfig.smtpemail); //Conta de email que vai usar

                                        if (!string.IsNullOrWhiteSpace(m_corretor.email))                     //Email para enviar
                                        {
                                            mail.To.Add(new System.Net.Mail.MailAddress(m_corretor.email));   //Email para enviar
                                        }
                                        else
                                        {
                                            //AtivarForm();

                                            //MessageBox.Show("Não foi encontrado E-mail para envio!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                            //return;
                                            splashScreenManagerP.CloseWaitForm();
                                            funcao("salvar");
                                        }

                                        /*if (cbxEnviarCopiarEmailAviso.Checked == true)
                                         *  mail.CC.Add(new System.Net.Mail.MailAddress(m_emailConfig.smtpemail));
                                         * if (!string.IsNullOrWhiteSpace(textBoxCCo.Text))
                                         *  mail.Bcc.Add(new System.Net.Mail.MailAddress(textBoxCCo.Text));*/
                                        mail.IsBodyHtml = true;
                                        mail.Subject    = "Distribuição " + cbxFolha.Text + " Avulso do " + cbxEmpreendimento.Text;//Assunto do email

                                        var EmailHtml =
                                            @"<h2 style=""text-align: center;""><span style=""color: #ff0000;""><strong><span style=""color: #0000ff;"">Distribui&ccedil;&atilde;o de Folha Avulso</span> <img src=""https://html-online.com/editor/tinymce4_6_5/plugins/emoticons/img/smiley-smile.gif"" alt=""smile"" /><br /></strong></span></h2>" +
                                            @"<hr/>" +
                                            @"<p><strong>&Oacute;la este &eacute; um e-mail autom&aacute;tico:</strong></p>" +
                                            @"<p style=""text-align:left;"">Foi distribuido para o Corretor:<span style=""color:#008000;""><strong>" + cbxCorretor.Text + "</strong></span>" +
                                            @", a folha avulso:<span style=""color:#008000;""><strong>" + cbxFolha.Text + "</strong></span>" +
                                            @" do empreendimento:<span style=""color:#008000;""><strong>" + cbxEmpreendimento.Text + "</strong>.</span></p>" +
                                            @"<p style=""text-align:left;""><span style=""color:#000000;""><strong>OBS:</strong><span style=""color:#ff0000;"">Se voc&ecirc; n&atilde;o solicitou ou n&atilde;o auturizou a distribui&ccedil;&atilde;o dessa folha no seu nome, por favor entre em contato com escritorio administrativo e informe sobre este e-mail, ou caso voc&ecirc; n&atilde;o seja esse corretor apenas avise que chegou e-mail pro corretor errado, obrigado.</span><br/></span></p>" +
                                            @"<hr/>" +
                                            @"<p><span style=""color: #0000ff;""><span style=""color: #000000;"">&copy;2018 -</span> <strong><span style=""color: #0000ff;"">Viva Bem, Viva Valle...</span></strong></span></p>" +
                                            @"<p style=""text-align: left;"">&nbsp;</p>";
                                        mail.Body = EmailHtml;
                                        await smtp.SendMailAsync(mail);

                                        //MessageBox.Show("Enviado com sucesso!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        //AtivarForm();
                                        splashScreenManagerP.CloseWaitForm();
                                        funcao("salvar");
                                    }
                                }
                            }
                            catch (System.InvalidOperationException)
                            {
                            }
                        }
                        else
                        {
                            funcao("salvar");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Verifique se todos os campos estão preenchidos!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #5
0
        private async void btnRecuperar_Click(object sender, EventArgs e)
        {
            try
            {
                if (c_usuario.AutenticarUsuarioEmail(txtUsuario.Text, txtEmail.Text))
                {
                    splashScreenManagerR.ShowWaitForm();
                    DesativarTela();

                    m_usuario.login        = txtUsuario.Text;
                    m_usuario.emailpessoal = txtEmail.Text;
                    _SenhaTemporaria       = rnd.Next(1000, 9999);
                    m_usuario.senha        = Convert.ToString(_SenhaTemporaria);
                    c_usuario.AlterarSenhaUsuario(m_usuario);


                    using (System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient())
                    {
                        m_emailConfig.smtpemail            = c_emailConfig.GetSMTpEmail();
                        m_emailConfig.smtphost             = c_emailConfig.GetSMTPHost();
                        m_emailConfig.smtpporta            = Convert.ToInt32(c_emailConfig.GetSMTPPorta());
                        m_emailConfig.smtpsenhaemail       = c_emailConfig.GetSMTPSenhaEmail();
                        m_emailConfig.smtpssl              = c_emailConfig.GetSMTPSSL();
                        m_emailConfig.smtpcredencialpadrao = c_emailConfig.GetSMTPCredencialPadrao();

                        smtp.Host                  = m_emailConfig.smtphost;             //"smtp.gmail.com"
                        smtp.Port                  = m_emailConfig.smtpporta;            //587
                        smtp.EnableSsl             = m_emailConfig.smtpssl;              //true
                        smtp.UseDefaultCredentials = m_emailConfig.smtpcredencialpadrao; //false
                        smtp.Credentials           = new System.Net.NetworkCredential(m_emailConfig.smtpemail, m_emailConfig.smtpsenhaemail);

                        using (System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage())
                        {
                            mail.From = new System.Net.Mail.MailAddress(m_emailConfig.smtpemail); //Conta de email que vai usar

                            if (!string.IsNullOrWhiteSpace(txtEmail.Text))                        //Email para enviar
                            {
                                mail.To.Add(new System.Net.Mail.MailAddress(txtEmail.Text));      //Email para enviar
                            }
                            else
                            {
                                AtivaTela();
                                splashScreenManagerR.CloseWaitForm();

                                MessageBox.Show("Não foi encontrado E-mail para envio!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }

                            /*if (cbxEnviarCopiarEmailAviso.Checked == true)
                             *  mail.CC.Add(new System.Net.Mail.MailAddress(m_emailConfig.smtpemail));
                             * /*if (!string.IsNullOrWhiteSpace(textBoxCCo.Text))
                             *  mail.Bcc.Add(new System.Net.Mail.MailAddress(textBoxCCo.Text));*/
                            mail.IsBodyHtml = true;
                            mail.Subject    = "SGS - Nova Senha de Acesso no Login: "******"";//Assunto do email

                            var EmailHtml =
                                @"<h2 style=""text-align: center;""><span style=""color:#ff0000;""><strong><span style=""color:#339966;"">Recuperar Acesso no SGS</span> <img src=""https://html-online.com/editor/tinymce4_6_5/plugins/emoticons/img/smiley-smile.gif""alt=""smile""/><br/></strong></span></h2>" +
                                @"<hr/>" +
                                @"<p>Ol&aacute;, sua nova senha &eacute;:" + _SenhaTemporaria + "</p>" +
                                @"<p style=""text-align:left;""><span style=""color:#000000;""><strong>OBS:</strong> Pe&ccedil;a para o administrador do sistema troca a senha para voc&ecirc;.<br/></span></p>" +
                                @"<hr/>" +
                                @"<p><span style=""color:#0000ff;""><span style=""color: #000000;"">&copy;2018 -</span><strong><span style=""color:#0000ff;"">Viva Bem, Viva Valle...</span></strong></span></p>" +
                                @"<p style=""text-align:left;"">&nbsp;</p>";
                            mail.Body = EmailHtml;
                            await smtp.SendMailAsync(mail);

                            MessageBox.Show("Um e-mail foi enviado para " + txtEmail.Text + " com uma nova senha!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            splashScreenManagerR.CloseWaitForm();
                            this.Close();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Não foi encontrado Usuário/E-mail favor verifique!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex.Message, "SGS - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }