The Movable Type User Manual

NOTE: This documentation is for Movable Type 3.2. If you are using a newer version, please see the documentation for Movable type 3.3x or Movable Type Enterprise.

« 8: TrackBack | Up | 10: Search »

Chapter 9: Email

In this section:


Email. Can't live with it. Can't live without it -- although many of us wish we could.

Despite the introduction of new tools such as weblogs, wikis, aggregators and instant messaging, and the growing notion that email is "broken," it still remains the de-facto, baseline, catch-all choice for online communications and collaboration.

In this chapter we'll delve into various ways that email is utilized with Movable Type.

Problem

You want to display an email address in a way that is hard for spammers to capture.

Solution

Apply the spam_protect global filter.

Discussion

Spam is the bane of our online existence and arguably the biggest problem with email today. To generate their lists of email addresses, many of these spammers use automated systems to harvest email addresses from web pages and other online resources.

The email tags in MT include a simple spam_protect argument for disguising the familiar pattern of an email address using entity-encoding characters. Assuming our author's email is race@drquest.com, this tag...

 <$MTEntryAuthorEmail spam_protect="1"$>

...would output...

 race&#64;drquest&#46;com

This is not foolproof, since one of these agents need only take the extra step of decoding entities to detect email addresses. It takes many layers to stem the flood of spam and this is but a simple first step to slow them down.

Problem

You want to use one of Movable Type's outbound email features and need to configure them.

Solution

Use the MailTransfer directive along with either the SendMailPath or SMTPServer directives based on your server's environment.

Discussion

Movable Type makes smart enough choices for default mail configuration settings that in many cases you will not be required to change anything.

Without any changes to the configuration, MT uses sendmail for outbound email services. By default it will look for sendmail in three standard locations: /usr/lib/sendmail, /usr/sbin/sendmail, and /usr/ucblib/sendmail. If sendmail is not in one of these locations on your system, you can specify it in the system configuration with the SendMailPath directive.

To switch to SMTP instead of sendmail, set the MailTransfer directive in mt-config.cgi to 'smtp'. (By default MailTransfer is set to 'sendmail'.) Using the SMTP option will require the Mail::Sendmail module from CPAN. You will also need to add the SMTPServer with the address of your SMTP server unless it is being hosted locally.

For development purposes, MailTransfer supports a third option, 'debug,' that will print outbound email to STDERR.

When MT sends a notification message it will, by default, use the author's email address as the sender and the receiver. This will cause some spam filters to reject these messages. Setting the EmailAddressMain directive in the system configuration with a valid email address will cause MT to send notifications using this address instead. While optional, this is highly recommended.

Missing EmailVerificationSecret. How is DebugEmailAddress used?

With our outbound email services configured, we can now put the email scripts included in MT to work.

Problem

You want to give readers the option of sending an entry to someone else via email.

Solution

Place a send entry form in your layout.

Discussion

Movable Type ships with a script called mt-send-entry.cgi. This script can be used to implement a simple "mail this entry" form that allows visitors to email links to entries.

To add this feature to a site, insert an HTML form that POSTs to the mt-send-entry.cgi script in your MT home directory with parameters of entry_id, to, from, message and _redirect. entry_id and _redirect should be hidden fields that are assigned values when the page is built. _redirect is the URL to send the submitter once the message has been sent.

Here is a generic form that could be used in an Individual Archive template to implement a mail-this-entry feature:

 <form method="post" action="<$MTCGIPath$>mt-send-entry.cgi">
 <input type="hidden" name="entry_id" value="<$MTEntryID$>"  />
 <input type="hidden" name="_redirect" value="<$MTEntryLink  archive_type="Individual"$>" />
 Email this entry to:<br />
 <input name="to" size="20" /><br /><br />
 Your email address:<br />
 <input name="from" size="20" /><br /><br />
 Message (optional):<br />
 <textarea name="message" rows="5" cols="20"  wrap="virtual"></textarea><br /><br />
 <input type="submit" value="Send" />
 </form>
 

This form could use to be refactored. labels, ids etc. which I can do however what about localization?

When a visitor fills out the form and presses the Send button, mt-send-entry.cgi checks that the required parameters have been submitted (all but message are required), checks if the to and from email addresses look valid, loads the entry by its ID, and sends a message using a simple internal template. This template includes the sender's message (if any), the title of the entry and its permalink.

Problem

You want to allow your readers to sign up to receive e-mail notifications.

Solution

Place a notification subscription form in your layout.

Discussion

Movable Type includes the ability to easily send an email notification to readers to alert them of new posts.

You can use the mt-add-notify.cgi script, along with a small HTML form in your templates, to provide simple subscription services to readers.

mt-add-notify.cgi allows readers to subscribe to and unsubscribe from a weblog's notifications list after a confirmation step to check that the email address is valid.

Prior to version 3.0D, this script only handled subscriptions, hence the "add" in the name. If it bothers you, you can rename the file and point your forms at the renamed script.

To make these features available to readers, you will need to insert some HTML code like that in the example below into one or more of your templates:

 <form method="post" action="<$MTCGIPath$>mt-add-notify.cgi">
 <input type="hidden" name="blog_id" value="<$MTBlogID$>" />
 <input type="hidden" name="_redirect" value="<$MTBlogURL$>" />
 <input name="email" size="20" />
 <input type="submit" value="add" />
 </form>
 

clean up form -- label, ids etc. what about unsubscribing???? do not hard code script name. use tag instead. what about localization?

Problem

You want to send out a notification when new content is posted to your weblog.

Solution

In the Edit Entry screen of the post you wish to notify subscribers about, click the Notification tab and press Send.

Discussion

Movable Type includes the ability to easily send an email notification to readers to alert them of a new post.

Notifications are never sent automatically when you post a new entry. They are sent from a small form found on the Notifications tab of the Edit Entry screen assuming you have been granted Send Notifications permission.

In the Notification tab, enter the text of the message you would like to send. Using the checkboxes to the left, you can optionally include the excerpt or the entire body of the entry. When ready, click Send. The notification message will be sent with a link to the entry and the message as you have specified. The contents of notification messages are limited to these options. The template cannot be modified from within Movable Type.

MT is not a full-fledged mailing list manager and has its limitations. While background tasks have been introduced in MT, they have yet to make it into this area of the system. The sending of notifications is run as a CGI process, so in order to avoid a browser timeout, MT breaks the notification list up into groups of 20 and sends them using the BCC field to maintain the privacy of subscribers. This grouping function also helps avoid any issues where the mail server might reject a message because the BCC list is too long. Messages are sent from the authors of the entries to themselves.

Many first-time users of the notification features are caught off guard when multiple copies of the notification they just sent arrive in their inbox. Don't be surprised -- this is a sign that the notification was sent correctly.

Problem

You need to manage the list of email notification subscribers to your weblog.

Solution

Click the Notifications button on the Weblog Toolbar.

Discussion

You can view and manage the list of subscribers in the Notifications section of Movable Type. You must be granted Edit Address Book permission to manage notifications.

This will be particularly helpful in dealing with bouncing and expired email addresses. You also have the option of adding email addresses manually if necessary. (Be nice and get their permission before you add them.)

Movable Type does not have a facilty for the bulk import of email addresses. This can be handled with a Perl script that uses the MT Application Programmer's Interface (API).

Problem

You want to receive email notification of any comment or TrackBack ping activity.

Solutions

Go to the Feedback Settings screen and pick one of the "E-mail Notification" options in either the Comments or TrackBacks section.

Discussion

Movable Type can send brief notification messages via email to keep you apprised of feedback activity on a weblog. When activated these message are sent to the author of the entry.

To specify email notification, look to the Feedback Settings screen. Under the Comments or TrackBack section are three controls labeled "Email Notification." These options are:

  • On

    Notifications will be sent to the entry author for all new comments or pings regardless of whether they are published or moderated.

  • Attention Required

    Notifications will only be sent when a comment or ping is in moderation and requires an author's attention to be published.

  • Off

    No notifications will be sent.

Junk never generates a notification. Correct?

Click the Save Changes button to save the changes.

Notice that if comments or TrackBacks pings are not being accepted for the weblog, then these controls will not be visible.

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.