Tuesday, April 28, 2009

email piping with PHP and cPanel

I had a lot of trouble piping emails to a PHP script today. There was a real scarcity out there in terms of information (or I just didn't know how to search for the right terms). So, I thought I'd post about my fun in case someone else got stuck. (By the way, I use cPanel 11 and started with this script.)

What I wanted to do was set up an email address that would pipe to a PHP script. That is, my PHP script would get a copy of the emails. Then the PHP script could parse the file and do whatever; make a database entry or something similar.

I ran into two problems.

First, I would get a return email that said "Local delivery failed." It would have this at the top of the email:
pipe to |/home/accountname/public_html/emailin.php
generated by msg@accountname.com
local delivery failed

I found some website somewhere that suggested changing the file permissions for the PHP script (emailin.php in this case). So that is what I did, and it seemed to help. I used the cPanel File Manager to change the permissions to 754.

That fixed this problem.

The second problem was that despite receiving the email at the script and doing the appropriate things with it, I would still get an error email back. So, even though it all worked, my email would bounce back saying:
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

pipe to |/home/accountname/public_html/emailin.php
generated by msg@accountname.com

The following text was generated during the delivery attempt:

------ pipe to |/home/accountname/public_html/emailin.php
generated by msg@accountname.com ------

Again, after a few hours of searching I found someone that suggested changing the hash bang at the top of the script file to this: #!/usr/bin/php -q

That dash q made all the difference.

This was my adventure.

Friday, April 17, 2009

Logo Design

Logos are everywhere. And I think every group needs a good logo, if they want to have their stuff easily recognized. I recognize logos much faster than I can read. Logos helps brand everything you do. Moreover, logos have truly utilitarian value for all types of cultural groups. Most churches and non-profits can benefit from a good logo. It ends up being used on websites, business cards and envelopes.

But, I have seen my share of ugly logos. (And, I must admit, I've even designed a few ugly ones myself.) As I am in the process of redesigning the Firelit logo, I did a little searching and found a couple good sites about logo designs, along with some sites with really good examples of logos.

David Airey has a good primer in logo design.

LogoPond has examples of well done logos.

Or use this site to see how "holy" your current church logo really is. He he ;)

Friday, April 10, 2009

javascript wonderland

There is a lot you can do with JavaScript and DHTML. You can have custom pop-up messages, you can make things move around the screen, you can have pop-down menus, you can even send data to web servers (AJAX). But, it takes some work to get everything running smoothly. Especially when you want a certain user interface to work great no matter what browser is used.

jQuery is a great solution for JavaScript and user interface problems. They have a wonderful library of visual affects and more. Just take a look at their demos to get a feel for what I am talking about (in terms of UI). Then, if you want to integrate it into your own site, just download the code and plug it in (with a few tweaks and bumps - but that is expected, right?). It is a great way to get good functionality going quickly and reliably in a web site.

Thursday, April 2, 2009

sIFR

Ever want to do a design for the web but are totally dismayed to find the font families available are very limited. There aren't many fonts to choose from when you want your design to look the same across all browsers.

Mike Davidson and Mark Wubben take the credit for this great solution called sIFR (Scalable Inman Flash Replacement). It takes the normal text within your page and places a flash movie over the text with whatever font you want. So your plain, boring text is hidden with a flash movie of identical content and your personal, fully-cross-browser-compatible font. You can learn a lot more by checking out their site. It takes a little effort to set up, but works good and is virtually seamless.