Wednesday, October 12, 2011

PowerShell script to send mail

        $headers = New-Object System.Collections.Specialized.StringDictionary
        $headers.Add("to", "test1@abc.com")
        $headers.Add("cc", "test2@abc.com")
        $headers.Add("bcc", "test3@abc.com")
        $headers.Add("from", "test@test.com")
        $headers.Add("subject", "Test Email Subject")
        $headers.Add("content-type", "text/html")
        $bodyText = "Hello how are you?"
        [Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($web, $headers, $bodyText)

No comments:

Post a Comment

How to launch a document by clicking a link to the file?

Word: <a href='ms-word:ofe|u|path/to/web/word/document.docx'>Link to document</a> Excel: <a href='ms-excel:o...