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,"yourTestMail@yourdomain.com",
"Test mail subject","test mail body")

$sent

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.

Advertisements

2 Comments

  1. Ridha said,

    April 6, 2011 at 9:55 AM

    Thanks…

  2. Siegfried Glaser said,

    May 22, 2013 at 1:13 AM

    Nice idea. 🙂
    Thanks!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: