104 lines
3.2 KiB
C#
104 lines
3.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using CCH;
|
|
using FFT;
|
|
|
|
namespace IBRCAD
|
|
{
|
|
public partial class frm_configserveremail : Form
|
|
{
|
|
Utility Utility = new Utility();
|
|
public frm_configserveremail()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void blkcamps()
|
|
{
|
|
this.txt_senderEmail.Enabled = false;
|
|
this.txt_host.Enabled = false;
|
|
this.txt_port.Enabled = false;
|
|
this.txt_pwd.Enabled = false;
|
|
this.txt_ssl.Enabled = false;
|
|
}//end blocked camps
|
|
|
|
private void unlockedcamps()
|
|
{
|
|
this.txt_senderEmail.Enabled = true;
|
|
this.txt_host.Enabled = true;
|
|
this.txt_port.Enabled = true;
|
|
this.txt_pwd.Enabled = true;
|
|
this.txt_ssl.Enabled = true;
|
|
}//end unblocked camps
|
|
|
|
private void btn_novo_Click(object sender, EventArgs e)
|
|
{
|
|
this.unlockedcamps();
|
|
}//end btn new
|
|
|
|
private void btn_save_Click(object sender, EventArgs e)
|
|
{
|
|
Boolean SSL;
|
|
int port;
|
|
if (txt_ssl.Text == "ssl" || txt_ssl.Text == "SSL")
|
|
{
|
|
SSL = true;
|
|
}
|
|
else
|
|
{
|
|
SSL = false;
|
|
}
|
|
port = Convert.ToInt32(txt_port.Text);
|
|
Utility.ServerEmailConfigWrite(Utility.FileConfigEmail, txt_senderEmail.Text, txt_pwd.Text, txt_host.Text, port, SSL);
|
|
MessageBox.Show("Configuração salva com sucesso!", "Configuração de servidor de e-mail", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
this.blkcamps();
|
|
}
|
|
|
|
private void frm_configserveremail_Load(object sender, EventArgs e)
|
|
{
|
|
if (Utility.IsFileEmpty(Utility.FileConfigEmail))
|
|
{
|
|
DialogResult result = MessageBox.Show("Arquivo de Configuração do servidor de email está vazio. Deseja realizar a configuração?", "Configuração de servidor de e-mail", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
|
|
if (result == DialogResult.Yes)
|
|
{
|
|
btn_novo_Click(sender, e);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Utility.ServerEmailConfigReader(Utility.FileConfigEmail);
|
|
txt_senderEmail.Text = ServerEmailConfig.senderMail;
|
|
txt_pwd.Text = ServerEmailConfig.password;
|
|
txt_host.Text = ServerEmailConfig.host;
|
|
txt_port.Text = ServerEmailConfig.port.ToString();
|
|
Boolean ssl = ServerEmailConfig.ssl;
|
|
if (ssl)
|
|
{
|
|
txt_ssl.Text = "SSL";
|
|
}
|
|
}
|
|
}
|
|
|
|
private void chk_showPass_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chk_showPass.Checked)
|
|
{
|
|
this.txt_pwd.PasswordChar = '\0';
|
|
|
|
}
|
|
else
|
|
{
|
|
this.txt_pwd.PasswordChar = '*';
|
|
}
|
|
|
|
}//show password
|
|
}
|
|
}
|