//C# code for sending emails using SMTP
using System;
using System.Collections.Generic;
using System.Web;
using System.Net.Mail;
public class EMail
{
public EMail()
{
}
public static bool SendEmail(string MailTo, string MailBody)
{
MailMessage myMailer = new MailMessage();
try
{
//-------construct the message stuff--------
//--- The email address of the sender
myMailer.From = new MailAddress("rpkessler@hotmail.com");
//--- The email address of the recipient
myMailer.To.Add(MailTo);
//---The subject of the message
myMailer.Subject = "Rocky Mountain Tours Confirmation";
myMailer.IsBodyHtml = false;
//---The message text
myMailer.Body = MailBody;
//-------------------------------------------
//-----------------now send it!-------------------
SmtpClient smtp =new SmtpClient("smtp.west.cox.net");
smtp.Send(myMailer);
return true;
}
catch
{
return false;
}
}
}