Send Email From SharePoint

This is an example of how to send an email from SharePoint.

Reference
Microsoft.Sharepoint (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.dll)

Code
SPWeb web = SPContext.Current.Web; if (SPUtility.IsEmailServerSet(web)) {    SPSecurity.RunWithElevatedPrivileges(delegate     {         StringDictionary headers = new StringDictionary;         headers.Add("from", "sender@example.com");         headers.Add("to", "receiver@example.com");         headers.Add("cc", "cc@example.com");         headers.Add("subject", "My Subject Goes Here");         // TODO: Make sure to replace the \n symbols with HTML br tag         if (SPUtility.SendEmail(web, headers, "Email body text goes here"))         {             // Emails is sent ok.         }         else         {             // Something went wrong         }     }); }