Created
March 1, 2015 10:45
-
-
Save rheid/0710690d24050a9c12b8 to your computer and use it in GitHub Desktop.
Returns SharePoint smtp server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
/// Returns SharePoint smtp server | |
/// | |
/// | |
private string GetSmtpServer() | |
{ | |
SPWebApplicationCollection spWebApplicationCollection = SPWebService.ContentService.WebApplications; | |
SPOutboundMailServiceInstance smtpServer = new SPOutboundMailServiceInstance(); | |
if (spWebApplicationCollection != null) | |
{ | |
foreach (SPWebApplication spWebApplication in spWebApplicationCollection) { | |
smtpServer = spWebApplication.OutboundMailServiceInstance; | |
return smtpServer.Server.Address; | |
} | |
} | |
return string.Empty; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment