Exemplo n.º 1
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            var ret = ACBrMail.MAIL_ConfigGravarValor("Email".ToUTF8(), "Nome".ToUTF8(), txtNome.Text.ToUTF8());

            ACBrMail.CheckResult(ret);

            ret = ACBrMail.MAIL_ConfigGravarValor("Email".ToUTF8(), "Conta".ToUTF8(), txtEmail.Text.ToUTF8());
            ACBrMail.CheckResult(ret);

            ret = ACBrMail.MAIL_ConfigGravarValor("Email".ToUTF8(), "Usuario".ToUTF8(), txtUsuario.Text.ToUTF8());
            ACBrMail.CheckResult(ret);

            ret = ACBrMail.MAIL_ConfigGravarValor("Email".ToUTF8(), "Senha".ToUTF8(), txtSenha.Text.ToUTF8());
            ACBrMail.CheckResult(ret);

            ret = ACBrMail.MAIL_ConfigGravarValor("Email".ToUTF8(), "Servidor".ToUTF8(), txtHost.Text.ToUTF8());
            ACBrMail.CheckResult(ret);

            ret = ACBrMail.MAIL_ConfigGravarValor("Email".ToUTF8(), "Porta".ToUTF8(), nudPorta.Text.ToUTF8());
            ACBrMail.CheckResult(ret);

            ret = ACBrMail.MAIL_ConfigGravarValor("Email".ToUTF8(), "SSL".ToUTF8(), Convert.ToInt32(ckbSSL.Checked).ToString().ToUTF8());
            ACBrMail.CheckResult(ret);

            ret = ACBrMail.MAIL_ConfigGravarValor("Email".ToUTF8(), "TLS".ToUTF8(), Convert.ToInt32(ckbTLS.Checked).ToString().ToUTF8());
            ACBrMail.CheckResult(ret);

            ret = ACBrMail.MAIL_ConfigGravar("".ToUTF8());
            ACBrMail.CheckResult(ret);
        }
Exemplo n.º 2
0
        private void btnEnviar_Click(object sender, EventArgs e)
        {
            try
            {
                int ret = ACBrMail.MAIL_Clear();
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_ConfigGravarValor("Email".ToUTF8(), "IsHTML", "1");
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_AddAddress(txtDestinatario.Text.ToUTF8(), txtDestinatario.Text.ToUTF8());
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_SetSubject(txtAssunto.Text.ToUTF8());
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_AddBody(txtBody.Text.ToUTF8());
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_AddAltBody(txtAltBody.Text.ToUTF8());
                ACBrMail.CheckResult(ret);


                foreach (String anexo in lstAnexos.Items)
                {
                    ret = ACBrMail.MAIL_AddAttachment(anexo, anexo, 0);
                    ACBrMail.CheckResult(ret);
                }

                ret = ACBrMail.MAIL_Send();
                ACBrMail.CheckResult(ret);

                MessageBox.Show("Email enviado com sucesso!", "ACBrMail - Demo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao enviar email: " + ex.Message.ToString(), "ACBrMail - Demo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                string eSessao = "Email".ToUTF8();
                int    ret     = ACBrMail.MAIL_ConfigGravarValor(eSessao, "Nome".ToUTF8(), txtNome.Text.ToUTF8());
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_ConfigGravarValor(eSessao, "Conta".ToUTF8(), txtEmail.Text.ToUTF8());
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_ConfigGravarValor(eSessao, "Usuario".ToUTF8(), txtUsuario.Text.ToUTF8());
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_ConfigGravarValor(eSessao, "Senha".ToUTF8(), txtSenha.Text.ToUTF8());
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_ConfigGravarValor(eSessao, "Servidor".ToUTF8(), txtHost.Text.ToUTF8());
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_ConfigGravarValor(eSessao, "Porta".ToUTF8(), nudPorta.Text.ToUTF8());
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_ConfigGravarValor(eSessao, "SSL".ToUTF8(), Convert.ToInt32(ckbSSL.Checked).ToString().ToUTF8());
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_ConfigGravarValor(eSessao, "TLS".ToUTF8(), Convert.ToInt32(ckbTLS.Checked).ToString().ToUTF8());
                ACBrMail.CheckResult(ret);

                ret = ACBrMail.MAIL_ConfigGravar("".ToUTF8());
                ACBrMail.CheckResult(ret);

                MessageBox.Show("Configuração salva com sucesso!", "ACBrMail - Demo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao gravar dados no INI: " + ex.Message.ToString(), "ACBrMail - Demo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }