The SPUtility.SendEmail method enables you to send an email from the context of a SharePoint Web (SPWeb) object. The SMTP settings associated with the SPWeb object are used to send the email. The method returns a boolean value that represents whether the email was sent successfully.
SPUtility.SendEmail Method (Microsoft.SharePoint.Utilities)
SPUtility.SendEmail (SPWeb, Boolean, Boolean, String, String, String)
example:
try
{
SPWeb thisWeb = SPControl.GetContextWeb(Context);
string toField = "mailaddress@microsoft.com";
string subject = "Test Message";
string body = "Message sent from SharePoint";
bool success = SPUtility.SendEmail(thisWeb,true, true, toField, subject, body);
}
catch (Exception ex)
{
// handle exception
}