Archive for the ‘Web Development’ Category

Using Google Apps Email as Your App’s SMTP Server

Monday, April 27th, 2009

Something I’ve held out on for a while now has been to switch over the settings for ActionMailer in my application(s) to point to my hosted Google apps account.   I figured it was probably time to do so as piping email notifications through my comcast email account is generally, probably, a bad idea (courtesy of the “No Duh” department).

Seems like it should be rather easy, no?  Just change action mailer to resemble:


ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "hosteddomain.com",
:authentication => :plain,
:user_name => "account@hosteddomain.com",
:password => "omgsup3rsecret"
}

Meh. Looks easy enough, right? Except for the fact Google’s got some magic TLS authentication thing going on – you’ll run into an error in your mailers resembling Must issue a STARTTLS command first.. Enough to make you work a little harder to get the magic working.

For those of you/us that are running Ruby 1.8.7 and Rails 2.3.x the answer is rather simple – add :enable_starttls_auto => true to your smtp settings, which will result in :


ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => 587,
:domain => "hosteddomain.com",
:authentication => :plain,
:user_name => "account@hosteddomain.com",
:password => "omgsup3rsecret"
}

And for the rest of you/us (that would be me) that are still sticking with Ruby 1.8.6, there is an answer in the form of the action_mailer_tls gem. Following the readme will get you to right where you want to be – shoveling all the mail you would like into the ether that is the interwebs.

Tags: , , , , ,
Posted in Site Work, Web Development, internet | No Comments »

Meta descriptions and keywords for each page and post in WordPress

Friday, April 3rd, 2009

After searching for a plugin that might accommodate this in WordPress and coming up empty, I went digging for a possible easy way to do this with the means available.   Logic dictates that with custom fields this should be rather easy to accomplish.

The only snag might have been that in retreiving a custom field for a page or a post you need the page or post’s ID.   Usually this id is readily available within “the loop”, but what about when we’re up in the <head> tags?    A little searching in the codex reveals that we can grab your pages’ ID with $wp_query->post->ID.  Fantastic – because, with that we’re pretty much done! Adding the following in your theme’s header.php file between <head> … </head> :

<meta name=”keywords” content=”<?php $key=”meta_keywords”; echo get_post_meta($wp_query->post->ID, $key, true); ?>” />
<meta name=”description” content=”<?php $key=”meta_description”; echo get_post_meta($wp_query->post->ID, $key, true); ?>” />

.. and “meta_keywords” and “meta_description” as custom fields with your desired content for each will get you to where you want to be.

Tags: , , , ,
Posted in Web Development, Work | 1 Comment »

WordPress hosted on XO Communications.

Friday, March 27th, 2009

Suffice it to say – it’s not a winning combination.   There are two definitive hacks you’ll need to get things to work.

First, a plugin to disable canonical URL redirection.  Second, a hack to wp-settings.php that circumvents the XO php configuration’s not having $_SERVER['REQUEST_URI'].

Update: the second hack will break the non-admin part of the site in the context of the current site I’ve been working on.  So your mileage may vary.

Tags: , , , ,
Posted in Web Development, Work | No Comments »

« Older Entries | Newer Entries »