Sending Email from SharePoint via PowerShell - Mysterious Question Marks

145
March 21, 2018, at 08:13 AM

I have been searching all day for an answer to this. My PowerShell script reads from a SharePoint list, creates an HTML email, then sends it to everyone in the company.

For some reason, when I insert images, the images appear in the emails, but they always have a random question mark before or after the image. It is not the question mark in the black diamond that people talk about. It's using UTF-8. I've also tried Western European (ISO) and it still shows.

Here is an example of the line before I send the email, written to the host in PowerShell:

<img src="LINK" alt="ALT.png" style="margin:5px;width:382px;height:243px;" width = "300" >​<br></p></div></div></div></BODY>

and then when I view the source in Outlook after it's sent:

<img src="LINK" alt="ALT.png" style="margin:5px;width:382px;height:243px;" width="300">?<br></p></div></div></div></body></html>

Boom, random question mark at the end of the img tag. I've tried to do a replace: $emailtext = $emailtext.Replace("><", " " >")

Didn't work.

One more example of before sent with a different image:

<p style="text-align:center;">​<img src="LINK" alt="ALT.jpg" style="margin:5px;width:253px;height:111px;" width = "300" >

And after:

<p style="text-align:center;">?<img src="LINK" alt="ALT.jpg" style="margin:5px;width:253px;height:111px;" width="300">

Again, boom, random question mark. This time before the img tag.

Please help. I need to roll out these emails very soon and this would be a little embarrassing. Thanks!

READ ALSO
How to make ReactPlayer scale with height and width

How to make ReactPlayer scale with height and width

I am using reactplayer for a youtube video which uses iframeI am trying to scale the video to my div and I want it to be responsive

542
Email has problems with css and will not allow css in the same file

Email has problems with css and will not allow css in the same file

It's like when I try to send email to a customer and add my css, it will appear and show that there are errors, such as in the image

151
Applying stylesheets after load

Applying stylesheets after load

I'm working on a project that loads modules that may or may not contain their own stylesheets in a json config file that exists for each module and I'm currently debating how to best implement the loading of said stylesheetsNo page reloads are done, so this is all done via JS/jQuery,...

152
flash of unstyle content

flash of unstyle content

I have an following issue with cycle2, all my images display briefly when the page loads, there is possible solution http://jquerymalsup

150