View previous topic :: View next topic |
Author |
Message |
x-raysteve
Joined: 01 Feb 2006 Posts: 53
|
Posted: Sat Feb 04, 2006 6:05 pm Post subject: Sending E-Mail with C-Sharp |
|
|
I was looking for a way to send e-mail in C# via SMTP and came across this tip. I thought I would pass it on here for anyone else who might be trying to do the same thing:
Quote: | using (MailMessage mailMessage = new MailMessage(new MailAddress(fromTextBox.Text),
new MailAddress(toTextBox.Text)))
{
mailMessage.Body = bodyTextBox.Text;
mailMessage.Subject = subjectTextBox.Text;
try
{
SmtpClient smtpClient = new SmtpClient(serverAddressTextBox.Text);
smtpClient.Send(mailMessage);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "EMail", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
} |
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|