0

We will be moving to Office 365 next month and are in the process of fine-tuning some small Exchange Online related issues.

The last problem I am trying to solve is getting our organization's logo embedded in our out of office autoresponder messages, as well as the using HTML formatted text (plain text would be easy but isn't what we want). This process has to involve PowerShell, in conjunction with the Windows Azure Active Directory Module, as pasting the images straight into the Outlook Web App doesn't work.

Currently, I can get the image to appear, but when I attempt to insert the formatted HTML text in the Outlook Web App interface (after getting the logo working), it breaks something and the logo no longer appears in automatic responses (although the text does at least show with HTML formatting, which is reassuring).

Here is the PowerShell command I am using:

Set-MailboxAutoReplyConfiguration support@(ourdomain).ca -AutoReplyState Enabled -ExternalMessage "TEXT <html><body><img src = http://(ourlogo).png></body></html>" -InternalMessage "TEXT <html><body><img src = http://(ourlogo).png></body></html>"

I can add plain text where it says "TEXT" and it will appear along with our logo just fine. Unfortunately, I can't get our HTML-formatted text to appear, without preventing the logo from showing.

I've tried manually editing the out of office message (to include text, after importing the logo with PowerShell), but the logo ceases to appear after making any significant manual edits to the message in the Outlook Web App. It seems I need to upload all the content (text + logo address) directly from PowerShell for best results.

So my question is, can anyone suggest how I can modify the above PowerShell command so that HTML tags in the text will be accepted by PowerShell and uploaded?

Below is the HTML-formatted text. I can't work out how to insert it into PowerShell without getting an error:

<p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>User Name</span></p>

<p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>User Title</span></p>

<p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Organization Name</span></p>

<p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Organization Address</span></p>

<p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>City, Postcode</span></p>

<p class=MsoNormal><b><span style='font-size:12.0pt;color:#1F497D'>P</span></b><span
style='font-size:12.0pt;color:#1F497D'> (123) 456-7890 <b>&nbsp;&nbsp;F</b> (123) 456-7890</span></p>

<p class=MsoNormal><b><span style='font-size:12.0pt;color:#1F497D'>E</span></b><span
style='font-size:12.0pt;color:#1F497D'> </span><span style='color:#1F497D'><a
href="mailto:support@(ourdomain).ca"><span style='font-size:12.0pt'>support@(ourdomain).ca</span></a></span></p>

<p class=MsoNormal><b><span style='font-size:12.0pt;color:#1F497D'>W</span></b><span
style='font-size:12.0pt;color:#1F497D'> </span><span style='color:#1F497D'><a
href="http://www.(ourdomain).ca/"><span style='font-size:12.0pt'>http://www.(ourdomain).ca</span></a></span></p>

1 Answer 1

1

It's (most likely) because the HTML you're trying to inject has characters that need escaping when included in a regular PowerShell string.

Instead, you can use a variable and a Here-String to define a block of literal text.

So, try this in a .PS1 script:

$Msg = @"
<html>
<body>
<p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>User Name</span></p>

<p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>User Title</span></p>

<p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Organization Name</span></p>

<p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Organization Address</span></p>

<p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>City, Postcode</span></p>

<p class=MsoNormal><b><span style='font-size:12.0pt;color:#1F497D'>P</span></b><span
style='font-size:12.0pt;color:#1F497D'> (123) 456-7890 <b>&nbsp;&nbsp;F</b> (123) 456-7890</span></p>

<p class=MsoNormal><b><span style='font-size:12.0pt;color:#1F497D'>E</span></b><span
style='font-size:12.0pt;color:#1F497D'> </span><span style='color:#1F497D'><a
href="mailto:support@(ourdomain).ca"><span style='font-size:12.0pt'>support@(ourdomain).ca</span></a></span></p>

<p class=MsoNormal><b><span style='font-size:12.0pt;color:#1F497D'>W</span></b><span
style='font-size:12.0pt;color:#1F497D'> </span><span style='color:#1F497D'><a
href="http://www.(ourdomain).ca/"><span style='font-size:12.0pt'>http://www.(ourdomain).ca</span></a></span></p>
</body>
</html>
"@

Set-MailboxAutoReplyConfiguration support@(ourdomain).ca -AutoReplyState Enabled -ExternalMessage $Msg -InternalMessage $Msg

Worked for me using Exchange 2010.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .