writeLetter.cs
上传用户:hncsjykj
上传日期:2022-08-09
资源大小:461k
文件大小:2k
源码类别:

Email客户端

开发平台:

C#

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace LYBemail
  9. {
  10.     public partial class writeLetter : Form
  11.     {
  12.         string smtp;
  13.         string port;
  14.         string userName;
  15.         string pwd;
  16.         public writeLetter()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.         private void btn_sure_Click(object sender, EventArgs e)
  21.         {
  22.             smtp = txt_smtp.Text;
  23.             port = txt_port.Text;
  24.             userName = txt_name.Text;
  25.             pwd = txt_pwd.Text;
  26.             panel_server.Visible = false;
  27.             panel_write.Visible = true;
  28.         }
  29.         private void btn_send_Click(object sender, EventArgs e)
  30.         {
  31.             #region
  32.             //sendSmtp send = new sendSmtp();
  33.             //send.username = userName;
  34.             //send.password = pwd;
  35.             //bool ch = false;
  36.             //if (check.Checked) ch = true;
  37.             //bool ok = false;
  38.             //try
  39.             //{
  40.             //    ok = send.Send(smtp, userName, txt_showName.Text, txt_toName.Text, txt_toName.Text, ch, txt_subject.Text, txt_content.Text);
  41.             //    if (ok)
  42.             //    {
  43.             //        MessageBox.Show("发送成功");
  44.             //    }
  45.             //}
  46.             //catch (Exception ex)
  47.             //{
  48.             //    MessageBox.Show(ex.Message);
  49.             //}
  50.             #endregion
  51.             sendMail lybsend = new sendMail();
  52.             lybsend._smtp = smtp;
  53.             lybsend._port = port;
  54.             lybsend._userName = userName;
  55.             lybsend._pwd = pwd;
  56.             lybsend._fromName = txt_showName.Text;
  57.             lybsend._toName = txt_toName.Text;
  58.             lybsend._subject = txt_subject.Text;
  59.             lybsend._content = txt_content.Text;
  60.             lybsend._isHtml = check.Checked;
  61.             if (lybsend.send())
  62.             {
  63.                 MessageBox.Show("ok");
  64.             }
  65.             else
  66.             {
  67.                 MessageBox.Show("error");
  68.             }
  69.            
  70.         }
  71.        
  72.     }
  73. }