Post to your MT blog by EMAIL!!
I know this is a much requested script, and after working with the author of this one, I did find a few other similar ones out there, but I’d never been able to get any of those to work - and this one did quite easily. In any case, Scott’s post about it is here.
You can see his detailed instructions here, but here’s the “Cliff notes version” for the people who install first and read the directions afterwards when it doens’t work
(that’s me, by the way) LOL!
1. Make sure your host provider has the following perl modules installed:
Mail::POP3Client
XMLRPC::Lite
2. Download the pop3-mt script (here). Save that locally - rename it pop3-to-MT.pl
3. Edit the variables as neccessary (see the comments in that file you downloaded)
4. Upload the file to your server. Make sure you CHMOD 755 the file.
5. Set up a cron job to run that .pl file as often as you see fit.
* * * * * /home/USERNAME/pop3-to-MT.pl
that would run the file every minute.
See your host provider about setting this up - if you have a cpanel like interface - there may be a “easy” and an “advanced” version of the interface to set up cron jobs.
6. To email a post, subject line should have a “#” before the text - that is what will let the script know that it’s an email to be posted. The subject line will be the title, the body of the email will be the text of the post.
Some personal experience notes:
-When sending posts by email - make sure you’re sending the email by PLAIN TEXT - otherwise you’ll get a bunch of junk mixed in with your post.
-This script does not currently support username/password - so technically - anyone that figures out which email is scanned for posts - well, you can imagine the possibilities.
I’d suggest setting up a special account with a hard to guess address: q3oikfq34rtjr90qw3p04j@yourdomain.com for example ![]()
-HTML in your posts (like links and stuff) don’t appear to work just yet. When I posted <a href=”http://www.google.com”>google</a> posted like this:
href=”http://www.google.com”>google
June 25th, 2003 at 10:49 pm
wow… i don’t use mt, but that is so cool! post to your site by email, nifty.
June 26th, 2003 at 12:22 am
But does it do attachments?
June 26th, 2003 at 1:12 am
i’ve got this functionality using david raynes mt-email which is a mt plugin. here’s how i did it.
June 26th, 2003 at 8:08 am
The script doesn’t handle attachments currently, nor does it let you select a category.
Both functions are on tap for the next version.
mt-email is a neat plugin. The only problem being that procmail has a rather baroque “recipe” syntax that could prove difficult for MT users who are not familiar/comfortable with UNIX. I opted to get away from procmail by polling a POP3 account directly. Its bad enough that I force users of this script to use cron
June 26th, 2003 at 9:03 am
I should imagine that the username/password pair validation will be an option in the next version as well.
I’m also considering writing a feature that will enable the user to run the script in daemon mode via a command line flag. This would cause the script to sleep for n number of minutes and then wake up to check/process mail before going to sleep again. This would remove cron from the equation and hopefully make things easier.
Also, I am considering coding an option to strip out html tags and entities to help folks who send mail in html form.
Feedback on proposed features is definitely welcome and should be send to saf@scottfallin.com.
June 26th, 2003 at 2:39 pm
Here it is, folks! The oft-requested posting by e-mail to a Moveable Type blog hack is finally available. On a personal note, I probably won’t try this one since I’m not too comfort…
June 26th, 2003 at 5:44 pm
I’m still working on getting the script to run… just entered the cron job and am waiting for 5 minutes to pass…
In the meantime… I was getting errors at first because when I saved the script.. my browser converted all <’s >’s to & lt; and & gt; so watch out for that. It also saved some HTML stuff at the top & bottom of the file.
June 26th, 2003 at 5:51 pm
Yes - please read my “personal experience notes” at the bottom of the post
HTML isn’t supported yet.
June 27th, 2003 at 2:55 am
I think you misunderstand… I wasn’t talking about trying to POST via email… I was talking about when I saved the post SCRIPT off Scott’s site.
June 27th, 2003 at 6:57 am
AHHH… doh! My bad.
June 27th, 2003 at 8:34 pm
BTW Scott… is there any way to fix the tendency to wrap lines artifically?
It seems to create & save new lines in the middle of my paragraphs which means my posts appear funky after MT’s done converting new lines into
’s
I also like the idea of being able to specify categories, esp multiple categories.
I also use the MT Plugin, Extrafields, to get Livejournal like “Mood” & “Listening To” fields in there… it’d be very excellent if there was some way to have those process as well.
June 29th, 2003 at 5:58 pm
Mega:
I haven’t had much time to revamp the script but the line wrap issue should be easy enough to solve, and if I recall correctly, the API makes provisons for categories. I’ll work on it.
July 2nd, 2003 at 9:22 pm
Hi all,
I have been working on this code all afternoon and have come to the conclusion the problem may not be on my end. I keep getting the error:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
Use of uninitialized value in pattern match (m//) at C:/Perl/site/lib/Mail/POP3Client.pm line 1001, line 2.
I have been in touch with tech support all afternoon and they claim the problem is with the script…is it possible this is the pop3-to-mt.pl script? I tried implementing a different script that calls the Mail:POP3Client and it returns the same error.
Thanks in advance!
The page is http://blog.paulnorwood.net/pop3-to-mt.pl
A text version is at http://blog.paulnorwood.net/pop3-to-mt.txt
And no, I did not alter the scripts.
July 3rd, 2003 at 10:21 am
You are you trying to run pop3-to-MT as a CGI?
It was not designed to run that way. It is a standalone script, designed to run of out cron.
The script was written using Perl verson 5.8.x
The problem is in your utilization of the script. The script runs quite well when invoked as it was designed to be invoked.
This script does not output http headers as it is not a cgi. It never was and never will be.
July 3rd, 2003 at 3:00 pm
Hey Scott,
Just wanted to say that the versatility of your script for the fact that the script can be run on one server, read mailbox on a 2nd server and post to a blog on a 3rd server really rocks cause that’s exactly what I’m doing!
BTW, is there any chance you could fix that line break issue I mentioned soon? I haven’t been using the script yet mainly because I didn’t want to have to go back and fix all the lines in my posts.
Are you using this site as the announcement of your script updates?
July 3rd, 2003 at 7:52 pm
Thanks Megalion
I should have some time this weekend to fix the line break issue. I’ve been neglectful of it as I’ve been chasing after a bright and shiny new Perl adventure.
I’m interested to see an example of what you’re experiencing, as I’m not running into the problem myself.
I’ll send you an email about it.
And no, I won’t be using Scriptygoddess to announce new releases. I’ll just post notices on scottfallin.com or set up an announcement mailing list or some such.
July 3rd, 2003 at 8:56 pm
Hi, I don’t know why I was trying to run it as a cgi…oversight I guess…now I have cron running it returns an error…Use of uninitialized value at /usr/local/lib/perl5/site_perl/5.005/Mail/POP3Client.pm line 1001, chunk 2. Do I have an older verson of Perl and that is the problem? Thanks, will try to run this from the shell.
Paul Norwood
July 3rd, 2003 at 9:02 pm
I get the same error Use of uninitialized value at /usr/local/lib/perl5/site_perl/5.005/Mail/POP3Client.pm line 1001, chunk 2. at the shell prompt as well.
July 3rd, 2003 at 9:28 pm
I modified my username (since I have to use the server name for my mail server) with a \@ thinking this may be the problem. Now when I run the script at the shell I get no errors, but it seems to not run at all.
Help!
Paul Norwood
July 3rd, 2003 at 10:59 pm
IT WORKS!!!!! I tried a different email account (one that doesn’t require the domain name in the username field) and it worked perfectly the very first time! I am SOOOO jazzed!
Now if it would only select a category field…
July 4th, 2003 at 6:50 pm
Hey Paul, I’m glad it is working for you! It sounds like that other email address is set up through Cpanel or somesuch. If it was, you can often use and address with a plus sign in place of the @.
I’m doing just that and it works out fine. Btw, escaping the @ sign was a good idea. I’m a bit surprised it didn’t work.
Mega: I couldn’t find an email address for you on your site. When you get a chance, email me. You can find my address at scottfallin.com. I’d rather not have the spambot harvest it, I’m sure you understand.
I’ve been posting to a test blog today trying to recreate your line wrap issue but can’t. I use a text only *nix based mailer, but I’ve also had success using Outlook, sending a post in plaintext and Outlook RTF.
I’m not sure why html tags are problematic either. I have no trouble marking up text, including achors for links and having them post successfully.
Plaintext is still the way to go with this script, but like I said, Outlook RTF seems to work well too.
July 6th, 2003 at 1:23 am
I have tried using the + sign, tried using \+ all to no avail. I have worked with a different perl module NET::POP3 and it works just fine with the intended meail address. I don’t know, I guess I will have to use that other email address. I would prefer not to though because it is an easily guessed one and I don’t really want spam or whatever to post to my blog before I realize it.
July 11th, 2003 at 3:02 pm
Hey Scott… I emailed you on Monday but haven’t heard from you… you can use blog AT megalion.com to contact me if you didn’t get my email and are still waiting to hear from me.
I’ll warn you that my response time may be iffy over the next week as I’m out of town and don’t know what kind of net access I’ll have til the 20th.
July 17th, 2003 at 2:43 pm
unfortunately i do not know and understand what cron is so far. does anybody have a link to a site where it’s explained for people who have no clue? LOL
does it only run for people who have their own server? or does this work for everyone who’s just got a provider and a domain of his own?
July 17th, 2003 at 4:14 pm
Cron (crond) is a program that comes with most Unix systems, including Linux. It’s job is simply to run specified programs at various intervals. For example, you could configure cron to clean out a folder every other month.
July 17th, 2003 at 6:28 pm
Cool plugin. After a lot of installing the things that it needs en finaly got it working i got this error :S
Output from command /home/Youri/pop3-to-MT.pl ..
Unsupported protocol ‘HTTP’
? What im i doing.. Realy want to use this plugin plz help me fix my problem.
July 17th, 2003 at 10:15 pm
Looks like you made the same wrong assumptions I did…it will not run from a browser. It is a command line utility only.
If you have access to the shell or can use cron it should work beautifully.
July 18th, 2003 at 12:31 pm
still nothing :S I’m using Webmin tool to config my cron job’s. Made de cron job and waited until the time i’v set it to.. Visited my blog and still no email to blog
Can there be a nother problem ? More pakages or somthing :S
July 19th, 2003 at 9:44 pm
Today was busy! I think people know by now that Rick is home and will watch Kayla while I help them
July 26th, 2003 at 11:22 pm
I haven’t perused Scriptygoddess lately so I’m missing out on all kinds of little gems like this handy little piece of code which notifies you by email when a Googlebot visits your site and this code which allows you to…
August 7th, 2003 at 9:45 pm
This script is such a great idea! I don’t know for sure if I have the modules needed. I thought I’d install it and find out!
I get this error when I run the script (command prompt or from cron):
“use” not allowed in expression at blog.pl line 86, at end of line syntax error at blog.pl line 86, near “use Mail::POP3Client” BEGIN not safe after errors–compilation aborted at blog.pl line 87.
Does that mean I don’t have the mail module? Can I install it in my web space and point to its location in the script?
August 19th, 2003 at 1:38 am
No points for elegance or robustness, but here’s a little hack to strip Hotmail’s advertising footer out of incoming pop3-to-MT posts:
# grab the body of the email (becomes body of post)
$post = $pop->Body($i);
$post =~ s|<br\sclear=all>.*?</html>{1}|</html>|is;
Add the third line into the pop3-to-MT.pl. It depends on the uniqueness of the <br clear=all> tag that MS prefaces their insert with. I don’t have other webmail accounts to test, but it’s easily adapted.
For those not familiar with regular expression pattern matching–like I was two hours ago–a few hints:
- the basic structure is s/find_this/replace_with_this/; Perl lets you use alternate separation characters, which allows use to search for “/html” without having to go cross-eyed
- the \s is a whitespace code
- the .*? operates as a wildcard
- i and s make the search case insensitive and treat the input string as one line (skipping any newline characters in the html)
- {1} is the maximum number of times the expression can be found; if it is found twice (on the off chance the same code is used in the message body proper), the replacement will fail and the message goes through
So, all we’re doing is replacing the html from MS’s first tag to the end with our own shorter and sweeter one. (Hey, you could even put a plug for pop3-to-MT in there, while you’re at it.)
Thanks to the Goddess and Scott for putting this out there.
p.s. I found it very useful to comment out the message delete function at the end while testing!
August 26th, 2003 at 6:35 pm
I apologize for all the false updated pings I’m sending out–I’m experimenting with a posting-by-email script to make it post from my phone. Why? Because it’s there, I guess….
August 26th, 2003 at 7:37 pm
I apologize for all the false updated pings I’m sending out–I’m setting up this post-by-email script so I can post from my phone. For some reason….
November 14th, 2003 at 11:55 pm
I am getting this error: “proxy: transport protocol not specified” after running the pop3-to-MT.pl. Did I miss out something? Or did my webhost block something? Please help, I really want this thing to work.
November 22nd, 2003 at 9:46 pm
I am also getting this error: “proxy: transport protocol not specified” after running the pop3-to-MT.pl. What’s your system configuration, Roy?
December 21st, 2003 at 9:41 am
I don’t understand this. If i use this to post via outlook (using yahoo! mail) it works fine but if i use my mobile to post it doesn’t and the post isnt recognized. I have included the # in the subject and all but it doesn’t work and I don’t know why. The two messages look the same apart from the fact their from 2 separate email adds
December 21st, 2003 at 9:45 am
and i’m using a sony ericsson t610 and adding the # via ‘add symbols’ !
January 12th, 2004 at 7:40 pm
I found this link: scriptygoddess I can send an email and post messages. Cool!…
February 18th, 2004 at 12:32 am
Lilia over at Mathemagenic writes about how MT (Typepad, actually), is more difficult than we seem to think. There is…
February 18th, 2004 at 12:07 pm
Thanks to Dirk, I was finally able to modify my posting script .I use pop2blog to post from emails. It handles attachements and is quite secure. I am now able to remove ANY tag from my providers by inserting a special string at the end of MY text.
Take a look at
http://www.cogev.com/blog/archives/2004/02/000073.php
February 18th, 2004 at 7:41 pm
Lilia over at Mathemagenic writes about how MT (Typepad, actually), is more difficult than we seem to think. There is…
June 28th, 2004 at 12:48 pm
This is a test post using the pop3-to-MT.pl script. I am sending this via Outlook and in plain text. The script was authored by Scott Fallin and more information on how to use it and set it up can be found here….
June 29th, 2004 at 11:15 pm
I ran this script and it looped and posted the email message nearly 60 times before it terminated. Any ideas why it’s doing that?
July 15th, 2004 at 5:02 am
i’m going to cover my experience with the phone i just bought as i try to to get it to play nice with my Mac. They haven’t hooked up as of yet, but the phone has initiated some major booty…
October 27th, 2004 at 4:34 pm
scriptygoddess Post to your MT blog by EMAIL!!…
October 30th, 2004 at 8:30 pm
Can anyone help me? In Internet Explorer 6.0 I am getting a Script Error when I try to send out an E-mail in Yahoo. It will only do this in Yahoo I can still send through my local ISP. The error name is ” ‘AC_selectedEMails’ is undefined’ “. PLEASE ANYONE HELP!!! PLEASE….
December 17th, 2004 at 1:36 am
Here I was halfway into messing around with Net::POP3 and Net::MovableType when I found this created one year prior no less! I thought I would be clever and with the in by making a new mobile phone bloggin perl script but someone has beat me to it! Congrats. Code was of course remarkably similar to what I had and seems to work great. Thanks!
December 22nd, 2004 at 10:10 pm
Did you find an answer to your question about not being able to send from Yahoo? we’re having the same error message..
thx
Rex
December 27th, 2004 at 10:14 am
Hey…any answer to the question about the error message in Yahoo when trying to send e-mail? I’m getting the same message all of a sudden!
December 27th, 2004 at 6:33 pm
We are having the same problem (not being able to send yahoo! mail)
December 27th, 2004 at 11:26 pm
Same Yahoo problem - and yahoo non-help offers no solutions. SO, what is the answer?
January 2nd, 2005 at 1:30 pm
Hello,
I try to access links form scottfallin.com but keep getting directed to a search page of sorts. Do you know another source for the scripts?
Thx
January 12th, 2005 at 1:42 pm
I can’t find this file ANYWHERE! Anybody got it laying around that they can send me?
January 25th, 2005 at 12:15 am
I had the same Yahoo email problem - What worked for me was replacing my (macromedia) flash.ocx file. I uninstalled all macromedia software, which included Macromedia flash player as well as Shockwave, and manually deleted flash.ocx. I then downloaded the new version of Macromedia flash player, and email works flawlessly now. I discovered this fix on another tech forum, see ‘nigelpratt’ http://207.58.143.178/forums/archive/index.php/t-6433.html
May 8th, 2005 at 8:30 pm
scriptygoddess There should be a few similar plug-ins that add the post-by-email to your Movable Type blog, but I’ve yet…