Check Sharepoint Mail Settings using Powershell

I was having some issue in our mail server and need to test if mails are going from SharePoint 2010 or not. I quickly wrote this PowerShell script for it

$site = New-Object Microsoft.SharePoint.SpSite("http://yoursite/")

$web = $site.OpenWeb("RelativePathOf/TestSite/")

$sent = [Microsoft.Sharepoint.Utilities.SpUtility]::SendEmail($web,0,0,"",
"Test mail subject","test mail body")


You can leave “”RelativePathOf/TestSite/” blank if need to test from root site.

Just open up your SharePoint 2010 Powershell console. Change the parameters and run. It will just send the test mail to account you specified in it. If it returns the true, you must have mail also delivered in that mailbox.