Thursday, January 22, 2009

Checking SMTP information for the webapplication

Scenario:
I wanted to send some emails from my custom code and thought of using the smtp information entered into Central Administration Web Application. So before even trying to send email , I wanted to check if the information is available or not.

Solution:
SPUtility class is very powerful class and provide whole bunch of helpful functions.

Code:


if (SPUtility.IsEmailServerSet(web)){
SPUtility.SendEmail(web,False,False,"name@email.com","Thanks", "howz life ?");
}
Article:
MSDN

0 comments: