How to post by mail and MMS to MovableType

Update, january 27. 2005:
The extremely kind PERL-guru Kenneth Raknes has helped me with some updates on the script. It is now uploaded and the link in this post points to the new version. See the file itself for a description of the bug fixes.

Original post:
I found an excellent script made by Yoz and Ben Milleare. This script makes a special blog for mobile posts, a moblog. What I wanted was simply the possibility to post to my regular blog by mail or MMS from my mobile phone and any E-mail client. I also wanted the possibility to post more than pictures. If I send a video file or a sound clip from my mobile phone, it is saved on the server and a link to the file is made in the post.

I also wanted it to support the special characters that we use in Norway.

So, I started editing the script, made some progress, but because of my lack of PERL-skills I soon needed some help. After some serious help from Trond Isaksen and Kenneth Raknes we got the script working the way I want. It is still messy, but it should not be too difficult to set up.

You can find the edited script here:
Link to edited mt-moblog script

You need to edit the following lines:
30 – insert the correct path to your MT-installation
45, 46, 47 – Insert the correct blog-id, author-id and category-id
81 – Insert the POP-server you will use
86 – Insert the POP user and password

You might want to edit these lines:
157, 158 – Width and height of thumbnail picture
206, 207 – HTML-code for the post itself

This is an example of a post that is made by mail:
Link to post done by mail

You need a folder to store the attached files, for my setup that is a folder called “images” in the same folder that the blog is kept. The script makes a new time stamped folder for each mail that comes in. All MIME-objects is saved in these folders.

This is the corresponding folder for the post mentioned above:
Folder with picture, thumbnail, text-file and HTML

Because I used Outlook to post this entry there is a HTML-file in the folder. The script always use the text-version of the mail.

Please feel free to use the script and contact me if you have problems.

Here is Ben’s original post about his version of the script:
MT-Moblog HOW-TO

And here is more information on posting to MT by email:
Problem: PostByEmail

How to post by mail and MMS to MovableType

13 thoughts on “How to post by mail and MMS to MovableType

  1. Scott says:

    First off. I would like to say Thanks! This is the first time I have been able to get a moblog script working for MT. I am however having one issue. When I post an email it shows the link to be “
    _scott/images/200507202206/07-06-05_2150.jpg” I believe line # 212 “$imagepath” is not removing the additional path in the location? Any ideas? Thank you in advance. Scott

  2. Strange. Maybe there is an issue with the way the script handles folders and paths. I have only used it on my own installation, so there might be issues with other installations that use other paths.

    I am currently running WordPress on all my blogs, so I am afraid I have no way of testing the script right now, so I can’t be of much help…

  3. Scott says:

    Yes. I did narrow it down to the “imagepath” varible, but if I remove it from the line it will take away the filename. It looks like this line # 212 when it says “$imagepath =~ s/^.*///; # remove everything from the start up to
    # and including the last slash” It is not removing everything down to the last slash, it keeps the full path in. I am no CGI expert but how can i modify the “~ s/^.*///;” to have it correctly remove everything before the last slash?

    PS. Can you please remove my web address from the previous post. I dont want spammers hitting the addr.

    Thank you in advance!

  4. Scott says:

    PSS. I noticed in your last post that you use wordpress vs MT. I am looking for a moblogger that pretty much matches the feature set of text america. I want to be able to email my photos and 3gp video from my phone and have it post to my blog. What is ur suggestion for the best blogger? MT or WordPress? If its wordpress, how does its moblog functions work? How much work is it to get working? ~Scott

  5. I was quite satisfied with the functionallity of MT, but I changed host and was not able to get the Moblog script for MT working at my new host.

    However, Dreamhost have a one-click-install of WordPress, and wordpress natively support post by mail. I had to do a hack here as well to make it support images, 3gp-files and automatic creation of thumbnails.

    I am quite satisfied with my solution right now. Running WordPress on Dreamhost with a modified “wp-mail.php”-script.

    If your want to try out wordpress please contact me and I will mail you a copy of my modified wp-mail script. I have not managed to make a detailed post on “how to moblog with WordPress” yet…

  6. Scott says:

    I have installed wordpress. My word, what an easy install. I already have it all up and running and am able to post with a program called postie. But instead of it making a pop-up of the images it just is a link to them. I would be interested in trying your script. If you can please email it to me at scott at inetstream dot tv. Thank you in advance, ~Scott

    PSS Can you please remove my web address from my first comment? Thanks.

  7. I have removed the web adress from the first post.

    You can find my modified wp-mail.php here:

    The archive contains wp-mail.php and mimedecode.php.

    – Read the instructions in the beginning of wp-mail.php
    – Create the folders for photos and files
    – Replace the original wp-mail.php with the new one
    – Throw in mimedecode.php in the same folder as wp-mail.php (the WordPress-folder)

    The script is quite messy, but it works. It is based on the one over here.

  8. Todd says:


    I started playing with Yoz’s code, on which your script is based, and found myself lost in the cleanup — your script is a definite improvement!

    One thing I’m trying to add is support for multiple attachments. My wife likes to email pics of the kids (multiple pics/email) and tweaking the script to handle multiple attachments is above my programming IQ. Any thoughts / suggestions / pointers?



  9. Cool. It’s nice when people find the stuff here helpful!

    Unfortunately for the MT-script I have started using WordPress and will probably not continue improving the script.

    You might get help if you contact Oyvind over at Brilliantdays. He has quite a bit of updated info on MT.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s