LibrarySites.Banner

Local Mail Servers & Sitecore

Last week Sitecore released E-Mail Campaign Manager (ECM).  From a technical perspective, what is exciting about this product is that it takes everything you know about building and managing websites using Sitecore and expands that to the world of email campaigns.  (In case you weren't able to identify the "exciting" part, it's the "everything you know" part: if you know Sitecore, you know ECM.)

New products beg to be tried out and tested.  So if you want to play with ECM but don't have an email server available, this post is for you.  I'm going to describe how to install and configure an email server, and how to configure Sitecore to use the email server.

Sitecore Application Center

Before I get started, I want to mention something about ECM and mail servers.  One of ECM's features is integration with the Sitecore App Center.  In case you're not familiar with the Sitecore App Center, it is a Sitecore-hosted server that provides various services to Sitecore servers.  In this case, the App Center provides ECM with mail relay services. 

Using the App Center as a mail service is quick, convenient and easy, but in certain cases it may not be appropriate.  Test or demo environments where Internet access is unavailable is a good example.  ECM provides the ability to use a local mail server instead of the App Center.  By having a local mail server running, ECM can be used even when network access cannot.

Important Note

If you follow these instructions you will have a mail server that can send and receive LOCAL mail only.  It will NOT allow you to send mail to the Internet.  The mail server can be configured to send mail to the Internet, but that requires additional configuration not covered in this document.  In addition, your network might block outgoing mail sent by a local mail server.

Install Mail Server

These instructions will use the hMailServer mail server.  This is a free mail server for Windows that supports IMAP, SMTP and POP3, so it can be used to send mail and to receive mail, which is important for our testing.  These instructions were written using hMailServer 5.3.2. 

When configuring hMailServer, you must provide a domain name that contains a dot. Since my machine isn't a proper server with such a name, I need to add an entry to my hosts file that maps the name localhost.com to the IP address 127.0.0.1.

Download hMailServer from the http://www.hmailserver.com website.

  1. Run the installer, using all of the default options.
  2. After the installer runs, the admin console appears. 

Configure Mail Server

Now that hMailServer is installed, it must be configured to send mail and receive mail.

  1. In the hMailServer admin console, click the "Connect" button.
  2. Click the "Add domain..." button.
  3. On the "General" tab, enter the following values:
    * Domain: localhost.com
    * Enabled: checked
  4. Navigate to Domains > localhost.com > Accounts.
  5. Click the "Add..." button.
  6. On the "General" tab, enter the following values in order to create a new mail account:
    * Address: myname
    * Password: password
    * Enabled: checked
  7. Click the "Save" button.
  8. Navigate to Settings > Protocols > SMTP.
  9. On the "Delivery of e-mail" tab, enter the following values:
    * Local host name: localhost.com
  10. Click the "Save" button.
  11. Navigate to Settings > Advanced > Auto-ban.
  12. Enter the following values:
    * Enabled: unchecked
  13. Click the "Save" button.
  14. Click the "Exit" button.

Configure Mail Client

hMailServer supports both IMAP and POP3.  This configuration has been tested using POP3.  Configuring a mail client is usually a simple matter, provided you know your server name and your username.  For hMailServer, a user's complete mail address is used for the username.  Using the configuration above, the appropriate value is myname@localhost.com.

Specify Mail Server for Sitecore

Different mail server settings are used in different places in Sitecore. 

Default mail server

The default mail server is configured in web.config.  The setting is "MailServer".  This setting is not required in order for either ECM or Web Forms for Marketers (WFFM) to send email.

Web Forms for Marketers

This setting is not required in order for ECM to send email, but it is required in order for WFFM to send email.  Configuring WFFM to send email requires access to Sitecore.

  1. In the Sitecore Content Editor, navigate to the following node:
    * sitecore > system > Modules > Web Forms for Marketers > Settings > Action > Save Actions > Send Mail
  2. Locate the following field:
    * Section: Submit
    * Field: Parameters
  3. This field contains XML that determines the SMTP server that is used.  Change the "Host" value to match your hostname, which in this example is localhost.com.
  4. Save your changes.

Email Campaign Manager

Configuring ECM to use your local mail server is a simple matter of changing a setting in ECM's config file "Sitecore.EmailCampaign.config".  The setting "UseLocalMTA" should be set to true.  Save the file and restart the application in order for the change to take effect.

Want to learn more?

  • Hi Andrei.  Using a remote SMTP server requires the "UseLocalMTA" setting be set to "true".  Currently, in order to use this option your Sitecore license key must support using this option.  You should check with your Sitecore representative to make sure your license supports this.  If you confirm that your license supports this option, the next thing to check is the log file.  You should be able to see if the connection to the remote server is being denied for some reason.

  • The "UseLocalMTA" option determines if the App Center is used or not.  The "local" part is relative to the App Center.  So your remote SMTP server is a "local" server as far as ECM is concerned.  What does your log file report when you set "UseLocalMTA" to true?  The App Center is a Sitecore-hosted service provider.  One of the services it provides is delivering the email generated by ECM.  (Another service is geolocation, and more services are continually added.  App Center will definitely be getting more attention in the near future.).    You should talk to your Sitecore representative if you want more information about App Center, or if you need credentials.

  • Hi Sitecore Team,   I'm using Sitecore v6.3 and trying to create role based menu.But It's not working. Suppose that I have created 5 pages and 5 menu items are showing.  Now I want to create one user who does have access only for 4 pages then once he/she logins should see only 4 menu items not 5.   Could you please let me know ? If it is possible in sitecore feature.Or how to achieve it.  Regards Nitish

  • The connection was success. And when i click test Mail it showing as email sent successfully. But i dont see them in the recipient Mail Box, what might be the issue Any Idea?

  • Hi Adam,  Is it possible to integrate the ECM with external system. In ECM we can fetch data from external system and send mail