Its a common tasks that every SharePoint administrator will have to perform is enabling SharePoint to send E-mails. Outgoing email settings can be configured within the Central Administration site by navigating to:
To Set Outgoing E-Mail Settings with PowerShell:
If you want it for MOSS 2007, Use:
Setup outgoing Email for a particular web application:
Its also possible to set outbound Email settings per web application. But in Central Administration, outgoing email settings are set globally to the Farm but not per web application. Say for e.g, We need different From/To addresses for different departments in the organization. Say, IT@Company.com or IT departments and Sales@company.com for sales department.
This is where PowerShell comes to handy!We can set outbound Email settings per web application using PowerShell:
stsadm -o email -outsmtpserver emailserver.crescent.org -fromaddress SharePointSupport@crescent.org -replytoaddress SharePointSupport@crescent.org -codepage 65001 -url http://server_name
To get the outgoing email Server Settings:
Technet Reference: Configure outgoing e-mail for SharePoint Server 2010
- Central Administration>> System Settings>> Configure outgoing e-mail settings
To Set Outgoing E-Mail Settings with PowerShell:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Define Outgoing E-mail settings $outboundServer = 'g1exchangehub.crescent.org' $FromAddress = 'Teamsites@crescent.org' $ReplyAddress = 'SharePointSupport@crescent.org' $Charset = 65001 #Get Central Administrtion Web site $WebApp = Get-SPWebApplication -IncludeCentralAdministration | Where { $_.IsAdministrationWebApplication } #Apply the Settings $WebApp.UpdateMailSettings($outboundServer, $FromAddress, $ReplyAddress, $Charset)
If you want it for MOSS 2007, Use:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") $CentralAdmin = New-Object Microsoft.SharePoint.Administration.SPGlobalAdmin $CentralAdmin.UpdateMailSettings($outboundServer, $FromAddress, $ReplyAddress, $Charset)

Setup outgoing Email for a particular web application:
Its also possible to set outbound Email settings per web application. But in Central Administration, outgoing email settings are set globally to the Farm but not per web application. Say for e.g, We need different From/To addresses for different departments in the organization. Say, IT@Company.com or IT departments and Sales@company.com for sales department.
This is where PowerShell comes to handy!We can set outbound Email settings per web application using PowerShell:
Get-SPWebApplication -Identity <web-app-url> Set-SPWebApplication -OutgoingEmailAddress SharePointSupport@crescent.org -ReplyToEmailAddress SharePointSupport@crescent.org -SMTPServer emailserver.crescent.orgIts also possible to set outbound Email using STSADM command line. To setup outgoing Email for a particular web application:
stsadm -o email -outsmtpserver emailserver.crescent.org -fromaddress SharePointSupport@crescent.org -replytoaddress SharePointSupport@crescent.org -codepage 65001 -url http://server_name
To get the outgoing email Server Settings:
(Get-SPWebApplication -IncludeCentralAdministration | Where { $_.IsAdministrationWebApplication } ) | %{$_.outboundmailserviceinstance.server}
Technet Reference: Configure outgoing e-mail for SharePoint Server 2010