Had a client getting this error when trying to send emails last week and have now spent several hours on Google trying to find a solution.
Biggest catch is that other scripts were able to send mail, so it seemed unlikely that it was the host. So I took the phpMailer class and uploaded it to a test folder and wrote a script that did pretty much exactly what ProofBuddy does and it worked just like it should.
After much confusion on my part, I discovered a typo in the email address that was used for sending. A character was left out – exampl.com instead of example.com. Guess 1&1 had something in place that checked if it was a valid domain before sending out.
I’m sure there’s a lesson in there somewhere. Either way, I’m glad it wound up being something relatively simple even if it did take me way too long to get there.
July 27th, 2010 | Tags: php, web design | No Comments
Needed a quick and easy way to create a bit.ly URL for another site of mine. Google came through for me.
David Walsh posted a short PHP function on his site that takes your bit.ly login, API key, and the URL to shorten and returns a nice, short bit.ly link.
Link: http://davidwalsh.name/bitly-php
Just put the function into your file and...
PHP:
-
$shortURL = make_bitly_url($longURL, $bitlyLogin, $bitlyAPIKey);
And that's it. A new bit.ly URL is created and stored in $shortURL for you.
I started using this on my @DailyFont Twitter feed today to post fonts as they're added to the site and after a couple of test Tweets it seems to be working without a hitch.
July 24th, 2010 | Tags: bit.ly, coding, php, Programming, twitter | 1 Comment
Came across an error after mistakenly clicking a link in my hosting control panel.
CODE:
-
Unable to locate httpd.conf at /usr/local/cpanel/Cpanel/ConfigFiles.pm line 27.
-
Cpanel::ConfigFiles::find_httpconf(undef) called at /usr/local/cpanel/Cpanel/ApacheConf.pm line 206
-
Cpanel::ApacheConf::loadhttpdconf() called at whostmgr/bin/whostmgr4 line 197
-
main::listaccts() called at whostmgr/bin/whostmgr4 line 157
At the time, WHM was working but none of the sites on the server would load. Trying to restart httpd manually from PuTTY resulted in an error that httpd.conf couldn't be found.
Fortunately, there was an easy fix.
CODE:
-
/scripts/rebuildhttpdconf
It's a script included with WHM that rebuilds the httpd.conf file. Ran it, waited a couple of minutes while the server churned, started Apache, and everything was back to normal.
July 24th, 2010 | Tags: apache, cpanel, hosting, linux, whm | No Comments
Working on web apps I find myself using the print_r command a lot, and I mean a lot. It helps trace out what data is going where, and more often what's not going where it's supposed to.
A few months ago I realized that I type this same bit of code way too often.
Does a nice job of wrapping the output in<pre> tags making it easier to trace through. But too much typing for as many times as I use it. So I spent 2 minutes kicking out a function named pre_r that does it for me.
PHP:
-
/**
-
* Wrapper for print_r with pre tags
-
* @param mixed $data What to display
-
* @param boolean $die Whether the function should die() at the end
-
*/
-
function pre_r($data, $die=false) {
-
-
-
-
if ($die) {
-
-
}
-
}
July 23rd, 2010 | Tags: php | 1 Comment
How did I not try this before today?
My normal method of needing two files open was to have the one I'm working on in Netbeans and the other in Notepad++ on separate monitors. Turns out you can drag the tab of an open file outside of Netbeans and it becomes its own window.
We're going to have to file that one under the wish I had thought of that a long time ago category.
June 30th, 2010 | Tags: java, netbeans, php, tips | No Comments
June 9th, 2010 | Tags: video, youtube | No Comments
For the better part of the last couple of days I've been trying to figure out why Safari was not allowing me to click on links. Aside from an annoyance, it's not good to have clients complaining... Read the rest of this entry »
June 7th, 2010 | Tags: coding, javascript, js, mac, prototype, safari, scriptaculous, web design | No Comments
Found myself needing to get an image off of my iPhone without using iTunes. On my Vista machine it's easy enough. The iPhone shows up as a device and it's browsable just like any camera.
Turns out it's just about that easy on my MacBook. Fired up Image Capture, selected the phone, and they were there. Just a matter of dragging and dropping the image I wanted and it was done.
June 7th, 2010 | Tags: apple, iphone, itunes, mac | No Comments