Skip to content

Instantly share code, notes, and snippets.

@rheid
Created March 1, 2015 10:45
Show Gist options
  • Save rheid/0710690d24050a9c12b8 to your computer and use it in GitHub Desktop.
Save rheid/0710690d24050a9c12b8 to your computer and use it in GitHub Desktop.
Returns SharePoint smtp server
///
/// 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