SprintPCS Moblog hack for WordPress 1.0 and above

January 21st, 2004

Here is the link to the moblog script.

1) Upload this file to the root of your blog (rename it to sprint.php) and put in the username and password of your blog in the required places within sprint.php.

2) Setup your email blogging parameters within WordPress. Your security is going to be the email address that your blog is supposed to check, so make it complicated (or something)

3) Send your blog an email (to the email address you specified above). Go to your blog URL and add the sprint.php at the end (on a browser) to test how well the works. e.g.
This should give you a very good understanding of what happens. If things work, you should see an entry in your blog with just that picture.

4) Now to make this automated, add a cron script to your webserver so this file gets run every so often (I have mine running twice every hour) The script is designed to check one email and then sleep until it is run again. It will delete the email of which it has made a successful post, so if you send many pictures to your phone at once, it will deal with them one at a time until all are done.

5) From your sprint phone: Take a picture, make a phonebook entry with your blog’s email address and “share” the picture with that entry in the phonebook. Do not add any message or any “voice attachment”. Do not send more than one picture per email. Test it out and see what works for you. Sprint does change the format of this email all the time, but I need to keep my own moblog working, so if things quit working, check my blog for updates.

Questions, comments, please email me.

*An Addition from Chris Chiles*
I modified some of your code to get the message and use it as the post title:
$ttl = explode(“<br />”, $content);
$fline = $ttl[0];
$sline = $ttl[2];
$sline = explode(“”, $sline);
$post_title = trim($sline[0]);

Thanks Chris!




  1. NIJI (1 comments.) says:


    I got the “error opening mailbox” error. I tried entering the $mailserver_* variables directly and it managed to get pass imap_open() (tested by printing out imap_num_msg($mbox) and it showed the exact messages as in my inbox), but it didn’t post the message. The same goes for moblog/b2mail though.

    Any ideas?

  2. Jill says:

    Hi Mark. Your hack rocks – many thanks for creating it. Am having the no-IMAP support problem that the other folks are. Am wondering what mail provider you yourself use for your WP mailbox? I have a (IMAP-free) hosted account but am wondering which mailhost you’ve had [or others] success with? Thanks!

  3. Terry says:

    Are you still working on this hack?

  4. Makoto (1 comments.) says:

    Hi. I am making this site (the above said) and I wanted to add a
    blog page but unfortunately I don’t know how to do it. I basically
    want like an html code or any code I can put in the box so when I
    access the “Blogger” page on the site, I will be directed to the blog
    page. Any help will do.

    Thank you.

    ~* Makoto *~

  5. Mark (36 comments.) says:

    Go to and download the latest release. Unzip it inside a folder of your site (a new one) and follow the instructions for installation. Then create a link from your main site (called link to blog or something) to the index.php inside your new wordpress folder. Voila. Now you have a blog. :)

  6. Tom (5 comments.) says:

    I can’t find the script… is the link broken?

  7. Mark (36 comments.) says:

    Try now. I fixed the link.
    Sorry about that. :)

  8. Tom (5 comments.) says:

    thanks! :)

  9. Tom (5 comments.) says:

    hmm… I can’t seem to make it work. It gives me “error opening mailbox”. the wp-mail.php script “works”, so i peeked inside both of them, and found that this one uses

    if (!($mbox = imap_open (“$mailserver”, “$mailserver_login”, “$mailserver_pass”))) die (“error opening mailbox”);

    to access the pop server, whereas the wp-mail.php seems to use this

    if(!$pop3->connect($mailserver_url, $mailserver_port)) {
    echo “Ooops $pop3->ERROR

    Am I missing something obvious? Is it totally unrelated to either of these issues? Thanks :)

  10. Mark (14 comments.) says:

    If this script breaks but the other one works, try this. Find this line in the script:
    $mailserver = “{“.$mailserver_url.”:”.$mailserver_port.”/pop3/notls}”;

    and remove the /notls so the line looks like:
    $mailserver = “{“.$mailserver_url.”:”.$mailserver_port.”/pop3}”;

    Please let me know if that works.

  11. Tom (5 comments.) says:

    well, at least it access the email account, and sees the picture, but it doesn’t actually save it anywhere on my server. I’ve created the /tmp/ directory and given it appropriate permissions, but it doesn’t actually save anything there, and the resultant post contains a php error from the template-functions. I really do appreciate all the help you’re giving me with this!

    I couldn’t find an email address for me, but I did send it a picture and not run the script, so that you can see for yourself what the error messages are. If you send me an address to email, I’ll send you the URL :)

  12. Tom (5 comments.) says:

    hmm I meant to say “couldn’t find an email address for you… i’ve looked around in the files, and have no idea what I’m looking for.

  13. Rocketer (2 comments.) says:

    Hi there,
    I really like the hack you did, BUT…it does not support POP3 (without IMAP) and lot’s of people running those things on isp servers can’t install your script. I will try my best to change the hack to a new hack, but hey…i am no god. Maybe you already have this hack.

  14. Joe says:

    Holy crud! Your hack rules! I’m still fine tuning it as I’ve gotten some kinda weird error showing up, but at least the image is retrieved just fine! Thank you! — now to work on taht subject line thing.

  15. John says:

    I get Call to undefined function: imap_open() in /home/….


  16. Mark (58 comments.) says:

    Then you do not have the IMAP functions on your server. In that case, this particular version of the script will not work.
    If I get some time, I might build the pop3 version of this script. Enough people have expresssed interest in a very good email to blog script that I might be persuaded. :)

  17. Rocketer (2 comments.) says:

    :razz: aye! that would be awsome…

  18. Tony O says:

    hi, im having the same issues with not being able to access the pop account,
    i get the error: “error opening mailbox” i have removed the /notls you referenced earlier.
    wp-mail.php does get the mails, but sprint.php can not access them :(
    can you think of anything else to check?
    i am running wordpress 1.2.
    thanks for the help

  19. Tony O says:

    ok, i have no idea if this means anything but, i noticed if i change the login info in the script to the wrong login and pass, it still gives me the same error, “error opening mailbox.” it doesnt give me a wrong password error or anything like that.

    maybe its not even logging into wordpress to get the mail address and login info?

    i really have no idea if that will help but i hope it will :)
    i went and bought a php book last night because i think i will be switching over to wordpress permantly once i get this moblog hack working, and i thought it would be helpful to learn php. but i think it will be a while before i can do anything this advanced.

    hope i helped in some way.


Obviously Powered by WordPress. © 2003-2013

page counter