using (SPSite osite = new SPSite("http://igrid102:1974"))
{
using (SPWeb oweb = osite.OpenWeb())
{
try
{
StringDictionary headers = new StringDictionary();
headers.Add("from","system@domain.com");
headers.Add("to", "anandraj@triadinfotech.com");
headers.Add("subject", "Welcome to the SharePoint group: ABC site: ");
headers.Add("content-type", "text/html"); //This is the default type
System.Text.StringBuilder strMessage = new System.Text.StringBuilder();
strMessage.Append("<br><br><b>Login Instructions: </b><br>");
strMessage.Append("<font color='red'><UL><li>If you are a US employee ALWAYS login in using the following login format </font><br>");
SPUtility.SendEmail(oweb, headers, strMessage.ToString());
Console.WriteLine("Mail send sucessfully");
}
catch (Exception ex)
{
throw ex;
}
}
}
No comments:
Post a Comment