TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Sending Email from SharePoint using Server Side Object Model
Prasham Sabadra
Jul 03
2015
Code
2.4
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
/// <summary>
/// Send email.
/// </summary>
public
static
bool
SendEmail()
{
string
emailBody =
"Email Body"
;
var messageHeaders =
new
StringDictionary();
messageHeaders.Add(
"to"
, toemailaddress);
messageHeaders.Add(
"from"
, fromemailaddress);
messageHeaders.Add(
"subject"
, emailsubject);
string
mimeType =
"text/html"
;
messageHeaders.Add(
"content-type"
, mimeType);
SPWeb currentWeb = SPContext.Current.Web;
try
{
email = SPUtility.SendEmail(currentWeb, messageHeaders, emailBody);
}
catch
(Exception ex)
{
//Exception handling
}
}//method
Send mail
Object Model
SharePoint