Rijwan Ansari Blogspot, .NET, CSS, C#.NET, VB.NET, ASP.NET, .NET Reporting, Crystal Reporting,

Rijwan Ansari Blogspot, .NET, CSS, C#.NET, VB.NET, ASP.NET, .NET Reporting, Crystal Reporting,
Visual Studio, .NET, SQL Server, SQL Query, ASP.NET, C#, VB, C++, CSS, JQUERY, AJAX, Javascript, .NET Reporting etc

Wednesday, June 24, 2015

SharePoint Powershell command to verify if the Outgoing Email Functions in Sharepoint Environment (Send Test Email Form SharePoint)

SharePoint Powershell command to verify if the Outgoing Email Functions in Sharepoint Environment

(Send Test Email Form SharePoint)


One can simply test outgoing email from SharePoint.

With PowerShell you can send a test email from within SharePoint.
Run the following code with SharePoint Management Shell (run as administrator)
Command:

$email = "Receiver@email.com"
$subject = "Subject Of Email"
$body = "Body Of Email, Test Text for Body"

$site = New-Object Microsoft.SharePoint.SPSite "http://sharepoint"
$web = $site.OpenWeb()
[Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($web,0,0,$email,$subject,$body)

// A True or False will confirm the message has been sent or not


-----------------------------------------------------------
If its true then the email will be delivered.
If its false then the email functionality does not work in the SharePoint box.