email

Sending Recurring Emails to Thousands, using Simplenews as a Backend

I recently had a rather unique project requirement on one of my sites: I needed to send out a weekly email to hundreds (soon to be thousands) of site users, with the same template each week, but with the latest data from the website.

Basically, what I wanted to do was create a View on my site of the latest 10-12 items, and have that view be sent out to everyone (along with the views header/footer) in HTML (with a plain text alternative, of course), but I didn't want to have to create a new newsletter by hand each week to do this (this is something at which the Simplenews module excels... minus the automation).

After debating over whether I should write my own module to do the dirty work of sending out batches of emails, using modules like Views Send along with Rules and Views Bulk Operations, and some other crazy ideas, I finally found a potent combination for sending out automated weekly newsletters in a highly performant and optimal way, using the following modules:

  • Simplenews (for queuing/sending emails, managing subscriptions)
  • Rules (for scheduling the newsletters)
  • Elysia Cron (for easy cron scheduling and performance)
  • Views (to build the body of the newsletter)
  • Mime Mail (to send HTML emails, and to be able to easily have a custom email-friendly stylesheet)

Drupal Simplenews: Automatically Subscribe New Users to a Newsletter

One of the sites I am setting up requires that all users be subscribed to a certain newsletter (or maybe two, depending on who they are) via Simplenews when they create their accounts (actually, their accounts are automatically created via LDAP... but that's another story).

Looking around, I found this post explaining how you might be able to auto-subscribe new users, and it led me to look up Simplenews' simplenews_subscribe_user() function.

Basically, you can add a line like the following in your custom module's hook_user() function, on the 'insert' $op (for Drupal 6):

Mac OS X Mail App: Deleted Messages Showing in Inbox

Earlier today, when I was working on fixing a few little inconsistencies in my mail inboxes (I currently sync 5 different accounts (with a plethora of email addresses feeding into the various accounts)), deleted messages started showing in some of my inboxes in Mac OS X's built in Mail app. They were greyed out, but not enough so that I could easily distinguish non-deleted messages...

After looking around online for a while, and not finding any fixes for this problem (I get so many emails that showing deleted messages basically makes my inbox unusable), I thought to search the Mail help for an answer.

Show Deleted Messages
Pesky little menu options!

I found a little menu item labeled "Show Deleted Messages" (Command-L keyboard shortcut), which somehow had been selected at some point (I can't think of why I would hit command-l in Mail... but I guess I did). Unchecking that hid the messages. Problem solved!

Use Gmail as an Alternate SMTP/Sending Server

I recently had to find a way to use SMTP for one of my email accounts which only allowed SMTP access through a port that was blocked by my ISP (AT&T), port 25. I decided to use my Gmail account, but realized my name/email would be changed to my gmail account (including the reply-to address). So I set up a new Gmail account for the sole purpose of acting as my SMTP server, and changed the default sending address using the following steps.

  1. In your Gmail account, click on Settings.
  2. Click on the "Accounts and Import" tab.
  3. In the "Send mail as:" section, click "Send mail from a different address."
  4. In the window that appears, put in your name and your original email address.
  5. After you add your original email address, you need to make it your default by clicking the 'make default' button.

Now you can set up your email client to use the Gmail SMTP server instead of your non-functional one, using port 587 with SSL turned on. Your email client should use email_address@gmail.com (for your Gmail account) as the username (just FYI).

Simple Steps to Protect Your Online Identity/Data

[Update: Back when this was written, very nice password managers like 1Password and LastPass didn't exist or were not very capable of managing passwords as well as they are today—please ignore the advice below and use a password manager to generate very long, random passwords, and use the password manager instead of memorizing anything.]

Every month or so, another scary story about a huge security compromise (a.k.a. a hack) surfaces on the Internet, and this month is no exception. Earlier this month, the whole Twitter corporate heirarchy had a lot to worry about, as a hacker (that's kind of a misnomer... hackers are usually nothing more than persistent, patient and sly computer users) accessed many Twitter employees' email, iTunes, Google, etc. accounts, all because of the fact that one of the employees (probably not the only one, though) left an open door via a few small missteps, security-wise.

The hacker, after gathering tons of personal information gleaned from all over the web, was able to recover a user's Gmail password by guessing a few personal questions Gmail asks on the password recovery form (i.e. "Who was your favorite actor?," "What is your maiden name?," etc.). Then the hacker simply searched through the user's emails for something like "username password," because he knew that a lot of websites (like the Joomla! forums, some gaming sites, online stores, etc.) simply send an email upon a new user registration that contains the person's username and password. Once the hacker got ahold of a few more passwords this way, he was on his way to 'hacking' all the user's accounts... because like most people online, the user had only one or maybe two passwords he used for everything.

...but using the same password for multiple sites/services isn't necessarily a bad thing. Not if you follow these steps:

Taming Mac OS X Mail - Previous Recipients

Mac OS X's Mail program has a very handy feature called 'Previous Recipients' that does a very nice thing: It saves a list of every person and email address you've ever sent an email to. Then, it automatically fills in that person's email address when you type it or the person's name in the 'To' field in a new message. This is usually a good thing, because it saves you time (you don't have to look up the address again!).

However, there are times when you want to send an email to a specific email address for that person, and the email address that Mail automatically inserts is—gasp!—the wrong address. For example, I want to send an email to my friend John, so I type in "John" in the To field. Mail fills in the address I usually send emails to: john@example.com. But I want to send the mail to John's alternate address, johntheman@example.com... and I want to start sending emails to that address rather than to his first email address all the time. There are two easy solutions to this problem: