Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 34890

Automation-System Center 2012 SP1 – Orchestrator–Fun with Email and Images

$
0
0

So, you want to send email leveraging Orchestrator activities to jazz up some of your automation?  This blog post will focus on a couple of ways to accomplish this.  In fact, this is a nice way to add some finishing touches on any user facing communication that may be executed within your IT process automation.  After all, pictures are really worth a thousand words.  Well – maybe not a thousand but you get the idea Winking smile.

Use Case – What is the Benefit?

Well, great question.  Let’s suppose you have an email you want to send out that is rich in graphics – maybe a “how to” document on using SharePoint or XYZ internal expense application.  Graphics help tell the story.  The below process pulls the details together to get this done.

Exchange Email with HTML

This first example is going to concentrate on the System Center 2012 SP1 – Orchestrator Integration Pack provided for Microsoft Exchange called the Exchange Users Integration Pack for Orchestrator in System Center 2012 SP1.  If you haven’t already gone out and grabbed this, registered and deployed it to your environment, this is a pre-requisite for what I’m about to show you.  So – Go get it, follow the detailed instructions and set it up!

Creating the Activities

To keep this very simple, I’m going to show you (2) activities.  One sets the published data for the end user you are emailing, the next sends the email. 

image

Initialize Send Welcome Email Activity - Start with the basics and then get crazy if you want to!

It’s this simple – request an email address to send to and let the next activity uses it as dynamic Published Data.

image

Create and Send Welcome Email

Now we modify the Create and Send Welcome Message activity

  • Subscribe to the EmailTo Published Data in the previous activity.
  • Create a Subject
  • Right click the Body field and select Expand
  • Paste in the example I have below this graphic (updating with your environment of course)
  • Make sure you change Body Type to HTML
  • Click OK, Finish.
  • Check it in and run it!

image

Note: I highlighted the “IMG” stuff to show you how you can reference graphics published on your internal websites as graphics to embed into email.  What’s better, you can update these graphics in one place and you don’t have to modify your content in Orchestrator.  Even better – it is secure because it is referencing internal data only accessible by your users if they are on your Corporate Network.

Example HTML Source exchange-html-source.zip

Here’s what you get for all your effort (my example of course)Smile.

image

 

Want to Keep it Easy on Yourself?  Start with an Invoke for Testing

Found under the “Runbook Control” section of activities, Invokes allow you to place values in your Runbook to call another Runbook and populate the parameters that are discussed later on in this post.

image

  • Browse to your Runbook with the Parameters by clicking the ellipse “…”
  • Provide your testing values

image

Note: Your called Runbook must be checked in to see the latest parameter data.  If you can’t see parameters, check it in and try again.

Want to Get More Dynamic?  Do it!

You can get as creative and dynamic as you want regarding the use of Published Data.  The point is this can be as flexible as you need it.  Want to paste the URL data dynamically instead of hardcoding it in the Exchange Activity?  No problem.

Update the Parameters to Include a New Parameter

Simply add a couple more parameters like “HTML Data” and “Subject” to the mix so you can take in HTML data as Published Data – this makes this activity useful for lots of scenarios.

image

Then Update the Createand Send Welcome E-Mail to Leverage the New Published Data

Go through and update each piece of “hard coded” data into dynamic Published Data and Voila! All dynamic!

image

Update your Invoke to Reflect the Updated Required Published Data

Place the data you need in Subject and HTML Data boxes, check it in and try it out!

image

 

You Want to Get Even Fancier and Add the Graphics in the Email?

Well – there is an option to add base64 email encoded graphics into your email message.  I will give you a piece of advice up front – this is a hit and miss from what I’ve seen and not supported in all email clients.  It also adds some weight to your email over what we’ve shown above.

SMTP in PowerShell with base64 embedding

First Create two new activities
image

  • Initialize Data Activity for your dynamic parameters (as shown in the previous example)
  • Run.NET configured as PowerShell for the PowerShell code shown below
    image 

Example PowerShell Code for SMTP PS-SMTP-source.zip

Final Tips

  • Makes sure the graphic(s) are available in the path specified on our Runbook server
  • Make sure you have a secure SMTP gateway
  • Make sure your service account has rights to send email through this gateway internally
  • Don’t use big graphics in email – size them appropriately or your Runbook Server could be churning through graphics and taking up memory unnecessarily Open-mouthed smile

Here’s what you get for all your effort in this scenario.

image

Note: Due to security in Outlook, you’ll need to open this email in the browser to see the graphics by opening the email and going to “Actions/View in Browser” from the toolbar.  Result below

image

Summing it up

To sum all of this up.  The Exchange IP does a nice job putting the HTML directly inline within an email message.  Using links to internal accessible locations will also allow you to provide graphics directly in your email messages, keep the size down, and provide some level of internal security (if necessary).  You can leverage the SMTP option in PowerShell to send a message in that manner and add base64 images embedded directly within the email message.  Limitation is that you need to open these in the browser to see them.  I’m sure there are other ways to do this.  Got some ideas and want to comment – please do and I’ll do my best to incorporate them in this blog post if they make sense.

Till next time, Happy Automating!


Viewing all articles
Browse latest Browse all 34890

Trending Articles



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