SMTP Auth Plugin

SMTP Auth Plugin for Movable Type

Version 1.0 by David Phillips (TweezerMan)

Download SMTP Auth plugin - SMTPAuth-1.0.zip

SMTP Auth is a plugin for Movable Type 4.2 and above which allows Movable Type to send notification e-mails through an SMTP server which requires authentication.

This plugin was created because my DSL provider does not allow the sending of e-mails through any SMTP server other than their own, and their SMTP server requires authentication. Without the ability to authenticate with an SMTP server, my local test installation of Movable Type was unable to send any type of notification e-mails.

Contents

Installation Instructions

Requirements

The SMTP Auth plugin requires Movable Type 4.2 or above.

The SMTP Auth plugin requires the following perl modules to be installed on the server:

  • Sys::Hostname
  • Time::Local
  • MIME::Base64

  • Net::SMTP
  • Authen::SASL

  • Net::SMTP::SSL
  • IO::Socket::SSL
  • Net::SSLeay

The Sys::Hostname, Time::Local, and MIME::Base64 may already be installed on the server as a part of the perl standard distribution.

The Net::SMTP and Authen::SASL perl modules may not be installed by default and thus need to be installed on the server before the SMTP Auth plugin can be used.

The Net::SMTP::SSL, IO::Socket::SSL, and Net::SSLeay perl modules are required only if the SMTP Auth plugin is configured to use an SSL connection to the SMTP server. If SSL is not used when connecting to the SMTP server, these perl modules are not required.

Installing the plugin distribution

  • The /plugins/SMTPAuth folder in the distribution should be copied to the /plugins subdirectory of the Movable Type installation directory.

  • The /mt-static/plugins/SMTPAuth folder in the distribution should be copied to the /mt-static/plugins directory for the Movable Type installation.

Configuring Movable Type To Send E-Mail Notifications

If Movable Type has not been previously configured for the sending of e-mail notifications, the following configuration directives may need to be set in the mt-config.cgi configuration file:

Required Configuration Directives

  • MailTransfer

The MailTransfer directive should be set to 'smtpauth' in order to for the SMTP Auth plugin to send notification e-mails to an SMTP server which requires authentication. If there is no MailTransfer directive in the mt-config.cgi configuration file, this directive should be added to the bottom of the file.

MailTransfer smtpauth

Optional Configuration Directives

  • EmailAddressMain

The email address of an administrator of the Movable Type installation. This is used as the "From" address on some outgoing emails, when no other email address is at hand. This setting may be set from within Movable Type on the System Overview > Settings > General page.

  • EmailReplyTo

A value of true (1) enables use of the Reply-To email header for notification emails. This will prevent MT from using the commenter's email address as the from address and will put it in the reply-to header instead. Example:

EmailReplyTo 1

E-mail Addresses in Author Profiles

Each author's profile in Movable Type should contain a valid e-mail address which can be used in notification e-mails as either the "From" or "To" address as needed by Movable Type.

Configuring the SMTP Auth Plugin

Browse to the System Overview > Plugins page in Movable Type, click on the "SMTP Auth" plugin name in the list of installed plugins to expand its display, then click on the Settings link:

SMTP Auth plugin configuration settings

  • SMTP Server

Enter the name of the SMTP server for Movable Type to use when sending notification e-mails.

  • Account Name

Enter the username required to log in and authenticate with the SMTP server.

  • Password

Enter the password required to log in and authenticate with the SMTP server.

  • SMTP server port number

Enter the port number to connect to on the SMTP server. The default port number for a non-SSL connection is port 25; the default port number for a SSL connection is port 465.

  • Use secure connection (SSL)

Check this box if the SMTP server requires a secure connection (SSL).

After changing any the SMTP Auth plugin settings, click the Save Changes button to save these settings in the Movable Type database.

Tip: Configuring SMTP Auth Plugin to use Gmail SMTP server (requires Gmail account)

  • SMTP Server: smtp.gmail.com
  • Account Name: your full email address (including @gmail.com)
  • Password: your Gmail password
  • Use secure connection (SSL): Check this box
  • SMTP server port number: 465 (default) or 587

(Above information from Gmail Help)

Testing the SMTP Auth Plugin

After the SMTP Auth plugin has been installed and configured, test the SMTP Auth plugin to verify that it is working correctly by sending yourself an entry notification e-mail:

  • Browse to the Manage > Entries page for your weblog in Movable Type.

  • Click on the title of a published entry to edit the entry.

  • Click the "Share" link near the top of the right sidebar.

  • Enter the e-mail address to send the notification e-mail in the "Recipients" box.

  • Click the "Send" button near the bottom of the page.

  • Check e-mail inbox for notification e-mail.

  • View the System Overview > Activity Log page in Movable Type, and see if any error messages were recorded indicating that the notification e-mail was not successfully sent.

Debugging the SMTP Auth Plugin

Due to the method used by the SMTP Auth plugin to provide its features, no error messages will be displayed within Movable Type when a notification e-mail fails to be sent for some reason.

If Movable Type does not appear to be properly sending notification e-mails after this plugin has been installed and configured, check the Movable Type activity log (System Overview > Activity Log) for any error messages logged by the plugin.

Disabling the SMTP Auth Plugin

Before disabling the SMTP Auth plugin, the MailTransfer setting in the mt-config.cgi configuration file should be set to one of Movable Type's default settings ("sendmail", "smtp", or "debug").

The SMTP Auth plugin may then be safely disabled by browsing to the System Overview > Plugins page in Movable Type and clicking the Disable link.

Changelog

09/30/2008 - Version 1.0

  • Initial public release.
  • Updated documentation.

09/03/2008 - Version 0.4

  • Convert from .pl file to config.yaml file for plugin loading.
  • Moved plugin template back into main-line code.

08/03/2008 - Version 0.3

  • Use MT::Mail 'mail_filter' callback instead of overriding MT::Mail::_send_mt_smtp.
  • Define 'mail_filter' callback as a priority 10 callback to run (almost) last.
  • Added support for specifying port number and SSL connection.
  • Removed option to enable / disable logging of error messages.
  • No longer log errors to web server error log.
  • Translate error messages recorded in Activity Log.
  • Use 'die' instead of logging subroutine to return and automatically log error messages.
  • No longer validate From: or To: e-mail addresses using MT:Util's is_valid_email().
  • Added support for DebugEmailAddress directive.

09/24/2007 - Version 0.2

  • Updated plugin for use with Movable Type 4.
  • Removed plugin config template from main code and placed it in separate .tmpl file.
  • Updated plugin system configuration template to use new MT4 tags.
  • Added config option to enable/disabled logging.
  • Updated "From" address checking in response to changes in MT4 code.
  • Added plugin documentation.

11/26/2006 - Version 0.1

  • Initial creation of plugin for Movable Type 3.3.

Leave a comment