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.

16 Comments

  • cody says:

    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”?)

  • cody says:

    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”?

  • gene says:

    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.

  • michele says:

    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?

  • cody says:

    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

  • michele says:

    but i can’t even OPEN the file.

  • gene says:

    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.

  • michele says:

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

  • KO says:

    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?

  • gene says:

    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.

  • Jacob says:

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

  • Jacob says:

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

  • gene says:

    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

  • 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

  • Letin says:

    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..

Leave a Reply

Your email address will not be published. Required fields are marked *