Categories
Uncategorized

Send test email from SharePoint

With PowerShell you can send a test email from within SharePoint.

Run the following code with SharePoint Management Shell

[code lang=”PowerShell”]
$email = "test@test.com"
$subject = "Test subject"
$body = "Test 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
[/code]

6 replies on “Send test email from SharePoint”

Hi Jeffrey

Thanks for the code. And when the message is “false”. Can you say me what if the problem? SMTP-Config i have made… My SMTP-Server is a internal Exchange SBS2011…

Thanks for a short message.

I am also getting false when I run the above code in SharePoint server 2016. Please help me on this. What is the problem?

Leave a Reply to kishore kumar Cancel reply