« Earth Day, 25 years ago | Main | Notice of Parking Violation Hearing Decision »

April 22, 2003

How to add "Email This Entry" functionality into your Movable Type weblog

This is a tutorial on how to enable the built in "Email This Entry" functionality of Movable Type for your weblog. This will create a link after each story on your main page (index.html) that says "Email This Entry" and will create a popup window asking for your email address, the email address of the person that you want to send the story to, and an optional message to send with it.

This tutorial depends on your website being able to handle php files.

  1. Browse to the Movable Type user interface (mt.cgi) and go to Templates
  2. Under Index Templates click Create new index template
    For Template Name give something like "Email This Entry"
    For Output File enter "send-email.php"
    In the Template Body copy and paste the text in this text file
  3. Click Save
  4. Click Rebuild
  5. Now that you've created the popup window containing the form calling mt-send-entry.cgi, let's move on to adding the link to your main index. Go back to the main Templates page.
  6. Go to Main Index (index.html)
  7. In the Template Body field add this first block of text inside the <head> section. You will want to place this immediately after the line which looks like this.
    <script language="javascript" type="text/javascript">
    The text to add is the following 5 lines
    function OpenEmail (c) {
    window.open(c, 
       'email', 
       'width=480,height=480,scrollbars=yes,status=yes');
       }
  8. The second block of text to add to the Template Body will go immediately after the line which looks like this :
    </MTEntryIfAllowPings>
    Notice the slash before the MTEntryIfAllowPings. This is a closing tag that you're looking for, not an opening tag. The text to add is the following 2 lines
    | <a href="<$MTBlogURL$>send-email.php?entry_id=<$MTEntryID$>" 
    onclick="OpenEmail(this.href); return false">Email This Entry</a>
  9. Once these two modifications have been completed, Save the Main Index template, and Rebuild it.
  10. Once both templates have been rebuilt (the new "Email This Entry" template and the "Main Index" template), browse to your weblog by clicking View Site
  11. Check to see that the "Email This Entry" link shows up after each entry near the "Comments" link.
  12. Click the link and verify that it creates a popup window with the Email form in it.
  13. Fill out the email form and email yourself. Make sure that the email arrives in your mailbox.
  14. You're all done.

Posted by gene_wood at April 22, 2003 10:19 PM

Comments

Gene,

What a great feature! You rock. I followed the instructions. But there is a problem:

The "send email" page is generated, but when i enter my email addresses and click send, an error page is generated with the message "cannot find server".

PHP is beyond me, but I think the problem has something to do with the java that creates the email. (something to do with the "entry_id"?)

Posted by: cody at April 22, 2003 11:56 PM

hey, so i checked my email and the script worked...i guess the only problem is an aesthetic one...is there a way to make a page after clicking the send button that says "A link to this blog entry has been sent"?

Posted by: cody at April 23, 2003 12:01 AM

Good call Cody, it was a bug in my script. I forgot to check it on Internet Explorer.

I've updated the file in step 2. Go ahead and Re-Do step 2 with the current file. Just copy and paste it into your "Email This Entry" template, and rebuild the template. Everything should work fine then.

Posted by: gene at April 23, 2003 07:52 AM

hmmm when i click on your example links to the send-email-example.txt, the window i'm in closes down..... what to do now?

Posted by: michele at April 23, 2003 08:23 AM

Gene,
it works.
Thanks!

Michele,
try saving the file to your hard drive and then copy and paste it from there into the "Email this Entry" template.
C

Posted by: cody at April 23, 2003 11:19 AM

but i can't even OPEN the file.

Posted by: michele at April 23, 2003 11:23 AM

If you can't open the file by clicking on the link, RIGHT click on the link and choose "Save link target as..." or "Save Target As...". Save the file to your hard drive then open it and copy and paste.

Posted by: gene at April 23, 2003 01:30 PM

you think you're so smart......well...hm, ok, that worked. thanks gene!

Posted by: michele at April 23, 2003 01:36 PM

Thanks for your method.. I've implemented it in my picture gallery. I just wanted to know: How can I include more information in the email? I want to have the entry text sent along also, not just the title.
I went through your code, and could not figure out how to customize it... can you please help my out?

Posted by: KO at June 20, 2003 03:15 PM

not a problem.

Also, KO, if you're looking for more functionality, check out MT-Mail-Entry. I haven't tried it but it looks good.

Posted by: gene at September 29, 2004 06:25 PM

Ironically, that "thanks" you just replied to was a spam-bot. *shakes fist at sky* You bastards!

Posted by: Jacob at September 29, 2004 06:51 PM

ugh.

Posted by: gene at September 30, 2004 08:53 AM

Oops. Spam deleted. Just so later readers know, KO isn't a spam-bot.

Posted by: Jacob at September 30, 2004 10:08 AM

oh, ya. I was responding to two different comments in one.

Not a problem was to a spambot (i'm dumb)
and the other was to KO

Posted by: gene at October 1, 2004 10:03 AM

Hi Gene,

Nice to see this send email method. Bravo!

I'm personally using a .cgi sendmail method, but i like yours as well.

Cheers,
Mihai

Posted by: Mihai Bocsaru at March 8, 2007 11:10 AM

its an amazing way of customizing my Email account ...i use this script ...its really working....eventually i face a problem while i was sending a mail its display an error of encrypt page script ..... please guide me ...why its happened...
is it a case of spamming.
i read a feature on an spamming info site ...http://www.anti-spam-info.com
so i scared from spammer...please help me..

Posted by: Letin [TypeKey Profile Page] at October 2, 2007 11:45 PM

Post a comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?