For a good part of tonight, I’ve been working on yet another idea. I wanted to be able to read email. Specifically, I wanted to grab email that I send through the snapshots and post the content and picture to my wordpress blog. Tonight, I figured it out.
I originally tried to use the methods in PHP provided for IMAP, POP3, and NNTP. I quickly found out that my GoDaddy account does not provide this library. I was stuck with finding an alternative. After some searching on the Internet, I later found out about a PHP Class to read email via POP3. The demonstration files only provided a way to access email messages, and not the attachments themselves. Even worse, the multiple content types that the message came in that I needed to read was not that easy to read.
I did a lot of tests and soon discovered how to identify different parts of content within the same email message. Email is litterally composed of a web page and many embedded images. I also learned how to decode (base64) data as I save it to the local file system. It’s very ugly code that I have written out, but I am sure that I’ll be able to clean it up.
The future is pretty bright for the capabilities that this offers. For starters, I can allow people the option to send snapshots to an email address to be used for products. Why save first before uploading to the site, when you can go direct?
The big one though, is for blogging. I originally started my blog with a watch hooked into slbuzz. I could only post text messages, and I had to say them out loud. I later switched over to blogHUD, which let me write note cards and drop them in to be posted. (No more talking to myself). Later, blogHUD also provided an email address that I could send snapshots to, that was also cross-posted to my wordpress blog. I’ve been using blogHUD for years, but I’ve had problems from time to time.
- blogHUD logo on my images.
- Can’t customize templates of posts
- No SLurl on the posts themselves (everything leads back to blogHUD).
- Doesn’t always work. (I have hundres of posts that never made it to wordpress)
- Somtimes posts the same image more than once.
- Breaks long links
- Doesn’t make use of categories or tagging.
With the ability to parse email, I am able to gain control over my own content. I can even add my own watermarks if I like. I’m even thinking about better control with sending content to PING.fm directly through their API.
I’ve tried going down this avenue many times before, but kept getting stuck at reading multi-part form data and finding libraries that would support it. Without this class to read email, I may still have been stuck.