writeLetter.cs
资源名称:Email.rar [点击查看]
上传用户:hncsjykj
上传日期:2022-08-09
资源大小:461k
文件大小:2k
源码类别:
Email客户端
开发平台:
C#
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace LYBemail
- {
- public partial class writeLetter : Form
- {
- string smtp;
- string port;
- string userName;
- string pwd;
- public writeLetter()
- {
- InitializeComponent();
- }
- private void btn_sure_Click(object sender, EventArgs e)
- {
- smtp = txt_smtp.Text;
- port = txt_port.Text;
- userName = txt_name.Text;
- pwd = txt_pwd.Text;
- panel_server.Visible = false;
- panel_write.Visible = true;
- }
- private void btn_send_Click(object sender, EventArgs e)
- {
- #region
- //sendSmtp send = new sendSmtp();
- //send.username = userName;
- //send.password = pwd;
- //bool ch = false;
- //if (check.Checked) ch = true;
- //bool ok = false;
- //try
- //{
- // ok = send.Send(smtp, userName, txt_showName.Text, txt_toName.Text, txt_toName.Text, ch, txt_subject.Text, txt_content.Text);
- // if (ok)
- // {
- // MessageBox.Show("发送成功");
- // }
- //}
- //catch (Exception ex)
- //{
- // MessageBox.Show(ex.Message);
- //}
- #endregion
- sendMail lybsend = new sendMail();
- lybsend._smtp = smtp;
- lybsend._port = port;
- lybsend._userName = userName;
- lybsend._pwd = pwd;
- lybsend._fromName = txt_showName.Text;
- lybsend._toName = txt_toName.Text;
- lybsend._subject = txt_subject.Text;
- lybsend._content = txt_content.Text;
- lybsend._isHtml = check.Checked;
- if (lybsend.send())
- {
- MessageBox.Show("ok");
- }
- else
- {
- MessageBox.Show("error");
- }
- }
- }
- }