SCOM C# how to get sharepoint's outgoing parameters
Solution
You can use below code for that
using(SPSite site = new SPSite(siteUrl))
{
string smtpHost = site.WebApplication.OutboundMailServiceInstance.Parent.Name
string fromEmail = site.WebApplication.OutboundMailSenderAddress
}
Or
var admin = new Microsoft.SharePoint.Administration.SPGlobalAdmin()
var server = admin.OutboundSmtpServer
var replyToAddress = admin.MailReplyToAddress
var fromAddress = admin.MailFromAddress
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange