Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Unable to set From Email Address using SharePoint Utility send mail

$
0
0

From Email address is not settting correclty using SharePoint Utiliy.I paste code below .Please help

 StringDictionary headers = new StringDictionary();
                        headers.Add("to", "xyz@gmail.com");
                        if (!string.IsNullOrEmpty(SPContext.Current.Site.WebApplication.OutboundMailSenderAddress))
                        {
                            headers.Add("from", SPContext.Current.Site.WebApplication.OutboundMailSenderAddress);
                        }
                        headers.Add("subject", subject);
                        headers.Add("content-type", "text/html");
                        headers.Add("charset", "utf-8");

                        SPSecurity.RunWithElevatedPrivileges(delegate()
                        {
                            SPUtility.SendEmail(SPContext.Current.Web, headers, "Body");
                        });


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>