Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Send Email using PowerShell
WhatsApp
Lakshmanan Sethu Sankaranarayan
10y
7.6
k
0
0
25
Blog
If you have to send email using PowerShell Command., then use SPUtility object to meet your purpose. Here is the code below.
$web = Get-SPWeb -Site
http://mysite
$headers = New-Object System.Collections.Specialized.StringDictionary
$message.To.Add("
[email protected]
")
$message.Cc.Add("
[email protected]
")
$headers.Add("from", "
[email protected]
")
$headers.Add("subject", "Test Email Subject")
$headers.Add("content-type", "text/html")
$bodyText = "Hello C# Corner?"
[Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($web, $headers, $bodyText)
Send Email using PowerShell
Up Next
Extract List Data To CSV File And Send An Email Through PowerShell
Ebook Download
View all
SharePoint Online And Office 365 Administration
Read by 3.6k people
Download Now!
Learn
View all
Membership not found