Friday, 30 October 2015

Send HTML Email through Powershell Using Microsoft.SharePoint.Utilities

Add-PSSnapin Microsoft.Sharepoint.Powershell

$headers = New-Object System.Collections.Specialized.StringDictionary

$headers.Add("to", "asishm@domain.com")       

$headers.Add("from", "system@domain.com")

$headers.Add("subject", "Task Details")

$headers.Add("content-type", "text/html")

$bodyText = "Hello <br>" 

$bodyText += "Following are the Task details : <br><br>" 


$bodyText +="<br>Thank and Regards,<br>"
$bodyText +="Asish,<br>"
$bodyText +="Company"

[Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($SPWeb, $headers, $bodyText)

No comments:

Post a Comment