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 System.Net;
using System.Net.Mail;
namespace email
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void SendButton_Click(object sender, EventArgs e)
{
try
{
MailMessage amessage = new MailMessage();
amessage.From = new MailAddress(FromTextBox.Text);
amessage.To.Add(new MailAddress(ToTextBox.Text));
amessage.CC.Add(new MailAddress(CCTextBox.Text));
amessage.Bcc.Add(new MailAddress(BCCTextBox.Text));
amessage.Subject = SubjectTextBox.Text;
amessage.Body = MessageTextBox.Text;
SmtpClient smtp = new SmtpClient("smtp server");
smtp.Send(amessage);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
private void ExitButton_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
No comments:
Post a Comment