public static void configureSmtpMail() { try { SmtpMailUtil.LoadCfg(); } catch (Exception ex) { MessageBox.Show(String.Format("Ocorreu um erro ao tentar configurar o servidor SMTP!\n\n{0}\n{1}", ex.Message, ex.InnerException)); Exit(-1); } }
private void btnConfigureSMTP_ItemClick(object sender, ItemClickEventArgs e) { ConfigureMailForm cmf = new ConfigureMailForm(); cmf.ShowDialog(); SmtpMailUtil s = new SmtpMailUtil(); s.receipts = new List <string>() { "*****@*****.**" }; s.receipts_cc = new List <string>() { "*****@*****.**" }; s.subject = "teste"; s.body = "isso é um teste"; s.SendMail(); }
private void btnSave_Click(object sender, EventArgs e) { try { if (!validator.Validate()) { return; } mails sm = ((mails)bdgMail.Current); sm.password = Util.Encrypt(sm.password); sm.Save(); SmtpMailUtil.LoadCfg(); XtraMessageBox.Show("Configurações salvas com sucesso!"); this.Close(); } catch (Exception ex) { XtraMessageBox.Show("Ocorreu um erro:\n\n" + ex.Message); } }