Does anyone knows of a way to embed an image to a powershell code sending email using SPUTILITY?

The image can be located on a shared location for that purpose (aka http://example.com/image.jpg)

Current code:

function sendMail
    asnp Microsoft.SharePoint.PowerShell
    $web = Get-SPWeb "http://mysite"
    $sd = new-object System.collections.specialized.stringdictionary

    $sd.add("Subject","Your new SharePoint site is ready")

    $body = "<font face='ebrima'>Hello</font>"
    $body +="<font face='ebrima'>Hi</font>"



Thanks, Effy.


of course you can. you actually don't need to build you dictionary, you can use this method: https://msdn.microsoft.com/en-us/library/ms477270.aspx

public static bool SendEmail(
    SPWeb web,
    bool fAppendHtmlTag,
    bool fHtmlEncode,
    string to,
    string subject,
    string htmlBody,
    bool appendFooter

Image needs to be somewhere where users will be able to access it and then just write your regular HTML.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.