Learning Movable Type: Email to a Friend
Updated September 23, 2004
Movable Type comes with a built-in capability for allowing your weblog visitors to easily send an email with a link to your entry by filling out a simple form. The one small catch is that spammers can take advantage of cgi email programs like this to send out spam. Ben Trott has made a few adjustments to the MT code in the most recent releases to help protect against these types of spammers. But the easiest way to take advantage of this useful utility while at the same time protecting yourself is to change the name of the mt-send-entry.cgi script. (See the reasons why here) The following are instructions on how to include Email to a Friend on your MT weblog, first starting with changing the name of the script.
1. Change the name of the mt-send-entry.cgi script. In your CGI bin change the name of this file to something else, also ending with the .cgi suffix. For example, mt-send-an-email.cgi (use something else - a unique name).
2. Copy the Send Entry form into your Individual Entry Archive template. The Send Entry code can be found in the Movable Type documentation here. Change the name of the cgi file in the first line of the code to reflect the new name of your Send Email cgi. Example:
Place the code on your Individual Entry Archive template where you would like the form to be. If you place it in the main body and not in the sidebar, you may want to expand the column size in the message window from "20" to something greater, like "45".
Nest the code in the appropriate style div tags for your site. For example, on this site, I put the email form underneath the comments section. I want the email heading to look just like the comments heading which, in MT3, uses <h2></h2> tags.
For default MT2.661, the heading tag would look like so:
In the case of MT2.661, after the Send Entry code I insert a closing div tag.
3. Link to the Send Entry form. You may want to place a link in the Posted To line (at the end of each entry) directing readers to the form. To do this, first place an anchor tag right before the form, like so for MT3:
or like so for MT2.661:
Then place a link on your Posted To line. On the Individual Entry Archive template the link would look like this:
On the Main Index template, the link would look like this:
That's it! Save and rebuild your site.
Links:
MT-Mail-Entry - a plugin for emailing the entire entry, not just a link, includes a popup email form.
Posted by Elise Bauer on April 16, 2004 5:42 PM to Learning Movable Type http://www.learningmovabletype.com/