Thank you Cabinetparts.com!

A couple of weeks ago the hinge on one of the cabinets in our kitchen broke. I took the door off, unscrewed the hinge, and went to Home Depot to try and find a replacement. No luck. I went to a local hardware store, same deal. I was annoyed, and worried I’d never be able to find a replacement. I headed home.

I looked at the broken hinge and found imprinted on it, in tiny numerals, was “32.260-01”. It also had “blum” imprinted on it, which I assumed was the brand name. A long shot, but I entered “blum 32.260-01” in Google. I was thrilled to see that while there were no organic results, there was a paid link for CabinetParts.com. I clicked through and found the exact part I needed. They were a little more than I’d hoped to spend, but since I had no idea where else I could go to find them, I was happy to pay it. I got the part a few days later and it was exactly what I needed. Cabinet: repaired. So, hooray for them!

I love syntax highlighting.

It occurred to me that someone probably already solved the problem of WordPress’s crappy handling of pasted code in posts. I found WP-syntax which does just that, so I’ve been going through and wrapping code chunks in the proper tags. The “<code>” tag is a total waste, and when I tried pasting in a chunk of XML in a recent post, everything looked like crap. So here’s to syntax highlighting.

Relaying through Google Apps using Sendmail to bypass EC2 spam blockage

Update 3 May 2011: I’ve subsequently modified our EC2 systems to relay SMTP mail through Amazon’s SES which doesn’t have the 500 messages per day limit that Google Apps does.

A few months ago I moved a site into EC2. I didn’t want to move the existing IMAP server (ugh) so I moved the email to Google Apps. There are only about 10 mailboxes so we went with “Standard” edition (free). Once we completed the move to EC2 we discovered that emails from our webserver were bouncing due to our EC2 IP address being listed in a spam RBL. This sucked, so I looked into relaying the mail from the EC2 webserver through our Google Apps account. Fortunately this turned out to be pretty easy.

This wiki page on scalix.com has a procedure for setting up SMTP relaying in Ubuntu with TLS & auth. I’m not running Ubuntu so the paths were different but it was basically the same procedure:

  • Create the file /etc/mail/client-info with these contents: AuthInfo:smtp.gmail.com "U:bounces@example.com" "I:bounces@example.com" "P:superpassword", where “example.com” is your Google Apps domain, “bounces” is a valid account, and the password is the account’s password. Mail relayed with these credentials will show “bounces@example.com” in the From: field of the message.
  • In /etc/mail, run makemap hash client-info < client-info
  • Edit /etc/mail/sendmail.mc, adding or uncommenting these lines:
    define(`SMART_HOST', `smtp.gmail.com')dnl
    define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
    FEATURE(`authinfo', `hash /etc/mail/client-info')dnl
    
  • Recompile sendmail.cf: m4 sendmail.mc > sendmail.cf . I got this error: “/etc/mail/sendmail.mc:10: m4: Cannot open /usr/share/sendmail-cf/m4/cf.m4” when running the command, but I resolved it by doing yum install sendmail-cf
  • Restart sendmail.

Once this was done I sent myself a test message from the command line and received it; I checked the SMTP headers and sure enough it went through Google’s mail server. One nice side effect is that all the mail sent by the webserver appears in the “Sent” folder for the Google Apps username provided in the client-info file. Hopefully this will resolve the spam issues, since the mail is now coming from Google’s IP block.