Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

unable to send email more then one user at a time using below powershell

$
0
0

hi,

Can any one suggest on below.

unable to send email more then one user at a time using below PowerShell. Giving below error

"Item has already been added. Key in dictionary: 'to'  Key being added: 'to'

[string]$bodyText=""
 $bodyText = "Dear ,"
 $bodyText+="`n"
 $bodyText+="Please find below"
 $bodyText+="`n"
 $bodyText+="Thanks and Regards."

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

        $headers.Add("to", "Test@domain.com")
 $headers.Add("to", "Test2@domain.com")
         $headers.Add("from", "Test@domain.com")
         $headers.Add("subject", "Details - new line not working.")
         $headers.Add("content-type", "text/html")
 [Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($web, $headers, $bodyText)


Thanks & Regards, Krishna


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>