Showing posts with label SPUtility.SendMail. Show all posts
Showing posts with label SPUtility.SendMail. Show all posts

Wednesday, October 27, 2010

Send Mails through Sharepoint 2007.

How to Send Mail from Sharepoint 2007

Mails can be send through a Sharepoint site as mentioned below.

string strTo = “To Address”;

string strFrom = “From Address”;

string strSubject = “Subject”;

StringDictionary headers = new StringDictionary();

headers.Add("to", strTo);

headers.Add("from", strFrom);

headers.Add("subject", strSubject);

headers.Add("content-type", "text/html"); //This is the default type, so isn't neccessary.

SPUtility.SendEmail(SPContext.Current.Web, headers, “Body of the Message”);

Before doing that, we need to set the Outgoing Email Settings in the Central Administration.


We need to give the Credentials in