spacer Contact Us | Site Map
spacer
 
  
spacer
Next Steps to Your Content Management System Take a QuickTour Visit the InfoCenter Schedule a Demo Get It Now

Developer Resources
spacer
Visual Editing
Developer Environment
Connector Gateway Tools
Code Samples
spacer


Email Integration


Email - both in and out of the CMS - is an important function.  It is particularly helpful if you are building a marketing campaign management tool, and want to integrate with an external email system - or need to send a piece of content out as email.

For one-off email messages, you can use the SMTP export configuration to allow an output.asp template file to publish vie email rather than FTP.  In addition there are API functions to generate and send an email which, along with a custom template file in the workflow, can be used for any custom notifications.

For email campaigns, you are probably using a separate system so you can take advantage of all the features in those systems.  CrownPeak CMS easily integrates with those systems via their email or HTTP API.  The following code sample comes from an implementation where the CMS is used to create email newsletters.  Once the content is entered, it's approved and put in a proof state where the text and HTML versions are sent to the email system via a HTTP POST, and the images are published on the live web server.  Once the proof is ready, the newsletter is sent via the external email system.  Then in the CMS, the newsletter is made live so any updates publish to the web site (where the past newsletters appear), but stop sending to the email system.

In the code, we are capturing the text and HTML versions of the news from other templates.  For the HTML version, we are specifying a small header and footer - for the web site, the page is wrapped in the site navigation HTML.  By using template includes, we can encapsulate the HTML in one place so that updates are easy.

<% system.startCapture() %>
  <html>
  <head>
    <title>Acme Newsletter</title>
  </head>
  <body>
    <!-- Start Table 1 -->
    <table width="550" border="0" cellspacing="0" cellpadding="0">
      <tr> 
        <td align="left" valign="top">
        <img src="http://www.acme.com/images/banner.jpg" width="550" height="70"></a>
        </td>
     </tr>
     <% system.include "/System/Templates/Newsletter/htmlbody.asp" %>
  </body>
  </html>
<% strHTML = system.stopCapture() %>

<% system.startCapture() %>
  <% system.include "/System/Templates/Newsletter/textbody.asp" %>
<% strTEXT = util.stripHTML(system.stopCapture())
%>

<% system.startCapture() %><?xml version="1.0" encoding="iso-8859-1"?>
<DATASET>
  <SITE_ID>912348</SITE_ID>
  <MLID>1222678</MLID>
  <DATA type="subject"><%= content.escapeItem("title") %></DATA>
  <DATA type="from-email">Newsletter@acme.com</DATA>
  <DATA type="from-name">Acme Online</DATA>
  <DATA type="message-format">HTML</DATA>
  <DATA type="message-html"><%= util.escapeHTML(strHTML) %></DATA>
  <DATA type="message-text"><%= util.escapeHTML(strTEXT) %></DATA>
  <DATA type="message-AOL"><%= util.escapeHTML(strTEXT) %></DATA>
</DATASET><% strPOST = system.stopCapture() %>type=message&activity=add&input=<%= util.urlencode(strPOST) %>

dots
spacer © 2008 CrownPeak Technology. All rights reserved. Toll Free Number: (800) 887-1944
spacer Site Map | rss_xml