<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dotnet thoughts &#187; SPContext</title>
	<atom:link href="http://www.dotnetthoughts.net/tag/spcontext/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotnetthoughts.net</link>
	<description>a dotnet developer&#039;s technical blog</description>
	<lastBuildDate>Wed, 08 Feb 2012 03:18:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SPUtility.SendEmail</title>
		<link>http://www.dotnetthoughts.net/2007/11/07/sputilitysendemail/</link>
		<comments>http://www.dotnetthoughts.net/2007/11/07/sputilitysendemail/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 23:02:49 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C#.Net]]></category>
		<category><![CDATA[Sharepoint API]]></category>
		<category><![CDATA[SPContext]]></category>
		<category><![CDATA[SPUtility]]></category>
		<category><![CDATA[WSS]]></category>

		<guid isPermaLink="false">http://anuraj.wordpress.com/2007/11/07/sputilitysendemail/</guid>
		<description><![CDATA[In my project I need to send mail to Administrator, while adding items to a list using Webpart. I have tried ASP.Net, System.Net namespace but I need to read all the server and mail settings from any config file. After &#8230; <a href="http://www.dotnetthoughts.net/2007/11/07/sputilitysendemail/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In my project I need to send mail to Administrator, while adding items to a list using Webpart. I have tried ASP.Net, System.Net namespace but I need to read all the server and mail settings from any config file. After I got sharepoint&#8217;s own mechanism to send mail.</p>
<pre class="brush: csharp; title: ; notranslate">
SPUtility.SendEmail(SPContext.Current.Site.OpenWeb(), false, false, &quot;admin@myserver.com&quot;, &quot;Hello World&quot;, &quot;This is a Sample Mail&quot;);
</pre>
<p>This will send a mail to &#8220;admin@myserver.com&#8221;, with &#8220;Hello World&#8221; as subject and &#8220;This is a Sample Mail&#8221; as body. You can send HTML emails by changing the third parameter to TRUE.</p>
<p>Update : You may need to use <strong>SPSecurity.RunWithElevatedPrivileges</strong> method to send mails.</p>
<p>Url :<a target="_blank" href="http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx"></p>
<p>http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx</a></p>
<p>This method enable users to Execute the specified method with Full Control rights even if the user does not otherwise have Full Control.</p>
<div class="betterrelated"><p><strong>Related content:</strong></p>
<ol><li> <a href="http://www.dotnetthoughts.net/2011/07/02/fluent-email-library-for-c-using-dynamicobject/" title="Permanent link to Fluent email library for c# using DynamicObject">Fluent email library for c# using DynamicObject</a>  </li>
</ol></div>]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2007/11/07/sputilitysendemail/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

