To send mails using SharePoint API, we can use SPUtility class sendMail method. For referencehttp://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.sendemail.aspx
To use this method we will require:
using Microsoft.SharePoint.Utilities;
using System.Collections.Specialized;
You can assign to, cc, bcc, from, subject by creating stringdictionary, like
StringDictionary headers = new StringDictionary();
headers.add("to",strTo);
headers.add("cc",strCC);
headers.add("bcc",strbcc);
headers.add("from",strFrom);
headers.add("subject",strSubject);
headers.add("content-type","text/html");
string emailBody = “Hi<br><br>Sending mails using SPUtility.”;
SPUtility.SendEmail
(web, headers, emailBody);
Where web is SPWeb object that represents site from which you want to send mail.
This certification is meant to test a person's knowledge of SharePoint 2010 application development but it's also a good way to learn about SharePoint 2010 development.
ReplyDeleteFor More Info :- Sharepoint 2010 Developers
Thanks.
Not Good
ReplyDelete