Connecting to an IMAP Mailbox with PHP

December 7th by Robert James Reese

There are a number of cool things that you can do after opening up an IMAP connection in PHP (monitoring bounce-back rates, processing incoming attachments, etc.) but before you do, you have get connected. Normally, this is a pretty straight-forward process, but sometimes different mail server settings can throw you a curveball. Here’s a couple quick tips to help you get started:

  1. Open up a phpinfo() page and make sure that you have the IMAP extensions installed. If you don’t, here are the instructions on how to get them.
  2. Copy our PHP IMAP Connection Tester onto your server and configure it with your account information.
  3. That’s it. I told you that was easy!

A note: I ran into the following error today: “Certificate failure for mail.example.com: Server name does not match certificate.” It took me a while to find the solution but finally came up with this — add /novalidate-cert after the port number. So, for example, if you’re using our tester, set $mail_port = 143/novalidate-cert; Hope that helps!

If you have any other tips, help the world out and share them below!

Image Upload Form, Cron Job Tester, & MySQL Table Copier

November 30th by Robert James Reese

Over the weekend, I posted three new code snippets:

The Image Upload Form has everything you need to create a simple HTML form allowing users to upload their own JPEG images. After it verifies that the image is valid, it saves it and generates a thumbnail using the PHP GD library of image functions. The code is clean, so it’s pretty easy to manipulate it to suit your needs (other file formats, different resizing, etc.)

The Cron Job Tester is the result of an epic battle I had with the server hosting one of my client’s sites. I couldn’t figure out why these cron jobs weren’t running and so constructed this little tester to simply log an entry in a text file every minute. From there, I was eventually able to find out that the host’s “Easy Cron” function was overwriting my crontab file. Arrrgh…

Finally, I posted the PHP code to Copy All the Rows in a MySQL Table to another, identical MySQL table. You can, of course, do this easily in phpMyAdmin, but I needed to have the function automated for this particular project. Hopefully you can get some use out of it too.

Almost There…

November 19th by Robert James Reese

I managed to sneak away from the whirlwind of other tasks on my desk for a few hours today to work on continuing the big switch-over from my old site to this one. I got some big progress made and now all the major pieces are now in place. There’s still some minor things that need to be tweaked and I still have to go down to the courthouse and make the name change official, but we’re almost there. It will be so nice to be officially Ink Plant and to get out of this state of limbo.

The biggest change (other than swapping out logos, etc.) that I made in the switch was to separate the site into 4 categories: Company, Network, Blog, and Code:

  • Company - This was the entire site before. It consists of the stuff you’d expect to see from a web development company: a portfolio, information about us, a sales pitch, etc. This is where I want to attract new development clients and also to provide a resource area (with invoices and such) for my current clients.
  • Network - Right now, this section simply lists and links to the various sites that Ink Plant maintains as a publisher. In the future, I want to build this out to include more information for potential advertisers on the Network.
  • Blog - You’re looking at it. I’m going to try very hard to keep posting up here regularly. I’d love to use this to start discussions regarding interesting aspects of the web development business.
  • Code - This is going to be a repository of code snippets that I’ve put together. I definitely have some work to do there still because there aren’t enough code chunks to be useful yet and the design looks kinda lame. But, that’s probably going to be a project for later…

Well, I hope you like the new site. If you have any comments/suggestions, send them my way. Have a good night everyone.

Slow Transitions

November 6th by Robert James Reese

I’ve been trying to juggle a million different projects lately and haven’t had much of a chance to write up here. I wish I could just pause time for a month or two and get caught up on this gigantic checklist of tasks that I want to get done on my sites.

One of the bigger tasks on the list is switching all the Lantenengo Industries stuff over to Ink Plant (I’m going to be officially changing my business name in the near future for branding reasons). Tonight, I got a decent-sized chunk of that switch taken care of: I closed down my old blog (redirecting it to here, of course) and pulled out the code snippets that I had published there, creating the new Code section of this site.

I also published a new code snippet that generates the PHP to display a MySQL table automatically. I’ve probably written this out by hand a couple hundred times, so it’ll be nice to finally have this little shortcut. Hopefully some of you will benefit from it too. Enjoy!

Advertising to Generate Advertising Revenue

October 11th by Robert James Reese

While watching the Phillies game last night, I saw several commercials for both WebMD and Ask.com. Seeing commercials that promote websites is certainly nothing new, but these caught my attention because they relate to something I’ve been thinking about lately anyway: Does it pay off to advertise your site if your only income from the site is coming from display advertising? Well, common sense will tell you No here — Getting visits to your site through advertising is almost certainly going to cost more than the advertising revenue that those visits generate. But… Why are the big guys doing it if it doesn’t pay off? Are we missing a piece of the equation here? Yes we are: the difference between visits and visitors. Although the specific visits coming in aren’t going to generate as much revenue as what you paid to get them there, somewhere down the road (if you have a good enough site that they keep coming back) they will eventually pay back that original advertising cost. How far down the road? Well, that depends on a lot of different factors. But, here is a case study that you can use as an example.

My network is admitedly a small fish in this big Internet pond, so I don’t typically have a lot of advertising dollars available to throw around. In fact, I’ve never really spent anything advertising for it before a few weeks ago when Visa was nice enough to give me a $100 credit on Facebook Ads. (I have done a fair amount of AdWords management for my clients in the past though, so I understood how the whole CPC system was setup.) I decided to spend the whole thing on my running site and chose the keywords running, run, and marathons as the targets of my campaign. After playing around a bit the first couple days, I settled on $0.21 as my default bid per click and set a $10 a day limit (No, I wasn’t kidding when I said this was a small experiment). So, 11 days and $100.58 later, I had generated 472 clicks from 509,441 impressions.

Of course, not all 472 of those clicks turned into registered users on my site. There was a fairly high immediate bounce rate of 49% (which I’ve heard is common when using Facebook Ads). And, of those that remained, only 36 (15%) went through the registration process and became registered runners on the site. (Note: That 15% number seems low to me. I’m brainstorming ways of improving it. Maybe quicker registration? More appealing style? But, that’s a topic for another post…) So, I ended up paying $2.79 to acquire each new runner.

Now, registered runners average 44.8 page views each month. All my advertising revenue on East Coast Runners is currently coming from AdSense, so I can easily find that my Page eCPM (the average revenue from each 1,000 impressions) is $1.44. So, in theory, to pay back the $2.79, I’d have to wait for the runner to visit 1,937 pages. At 44.8 pages a month, that’s over 43 months away. According to this simple calculation, it would take three-and-a-half years to break a profit.

Of course, there are other things to take into account: runners from the original ad campaign might share the site with a friend (+), or they might stop using the site before their required 3.5 years (-). Also, the 92% of visitors who didn’t become runners generated advertising revenue of their own (+). But these are all tough (impossible) to calculate exactly, so for the sake of argument, I’m just going to assume that they balance out to zero.

To conclude, my little experiment found that CPC advertising for a site similar to mine is not worth it unless you’re willing to deal with a really long wait before seeing your money back. Maybe that’s what WebMD and Ask are banking on — the fact that the investment will come back far down the road. But, they certainly have different conversions, return rates, eCPMs, etc. so it’s tough to say for sure.


Copyright © 2009, Ink Plant. All rights reserved.