All posts tagged ‘email’

File Under: Programming

Four Regular Expressions to Check Email Addresses

How do you find out if a user has entered a valid email address? Do you check for an at-sign, or is it more complicated? For many developers the answer is a regular expression, a little bit of code that can describe text patterns using wildcards and other special characters. If you’re new to the topic, we have a great regular expression tutorial.

Here are four regular expressions (often called regexes) that all validate the format of an email address. They have increasing degrees of complexity. The more complicated, the more accurate each is at matching only email addresses.

1. Dirt-simple approach

Here’s a regex that only requires a very basic xxxx@yyyy.zzz:

.+\@.+\..+

Upside: Dirt simple.

Downside: Even invalid email addresses like xxxx@yyyy.zzz, or even a@b.c, make it through.

2. Slightly more strict (but still simple) approach

Regular-Expressions.Info provides a basic email validation regex that tries to be a little smarter:

[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}

Upside: Only allows email address-friendly characters, restricts domain extension to only two to four characters.

Downside: It still allows many invalid email addresses, and misses some longer domain extensions (.museum, for example).

3. Specify all the domain extensions approach

Reddit user teye points to his regex, which only allows domain extensions that actually exist:

([a-z0-9][-a-z0-9_\+\.]*[a-z0-9])@([a-z0-9][-a-z0-9\.]*[a-z0-9]\.(arpa|root|aero|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|([0-9]{1,3}\.{3}[0-9]{1,3}))

Upside: It doesn’t allow xxxx@yyyy.zzz!

Downside: Upkeep could be tough with this one. You’d have to update any time new domain extensions are announced. In fact, you already would need to add the .me extension.

4. Way complicated approach

A Perl module has a long regular expression based on the standard description of an email address. It’s so long (nearly 6,500 characters!) that I won’t include it here.

Upside: It’s complete.

Downside: It’s way complicated.

Meet in the middle approach

You’ll have to decide, if you haven’t already, which regular expression to use. Likely, you’ll choose somewhere in the middle of the examples we’ve given. Regular-Expressions.Info has a good run-down of the trade-offs of different approaches.

Have you already decided how to check email addresses? How do you do it?

[via Reddit]

See also:

File Under: Web Basics

The Safest Way to Publish Your Email Address

At the dawn of time, including your email address on a web page didn’t seem like a horrible idea. Now, that’s the easiest way to get on every spam list around. Sadly, this makes it a little more difficult to solicit email from site visitors.

Silvan Mühlemann decided to find the best way to safely publish an email address. He started his test almost two years ago and recently published the results.

Silvan created nine email addresses and use a different method of obfuscation–nine different ways of hiding the actual address. Of the methods he tested, three of the email addresses never received a spam message.

The simplest method is to add markup with display: none styling so it doesn’t show:

email@<span style="display: none">null</span>example.com

The other two methods are reversing backwards text with unicode declarations and simple ROT13 encoding using JavaScript to decode. Next on the list, receiving just a few spam emails, was the popular email AT example DOT com method. Silvan did not test the email-as-image method, one employed by Facebook on its profile pages.

These methods probably won’t work with a mailto: link for easy clicking. Still, they all allow copy-pasting, instead of laborious re-typing, so they’re worth a shot. And yes, I know you could just use a contact form, but isn’t that a little impersonal? I think so.

File Under: Software & Tools

Catch a Glimpse of Mozilla’s E-Mail Future in Thunderbird 3 Alpha 1

thunderbird3.jpg

It’s alive! Mozilla has released the first alpha version of its upcoming Thunderbird 3.0, the company’s next-generation e-mail application. We don’t suggest you rush out and download it unless you’re a true early adopter; this release isn’t stable and lacks many of the features planned for Thunderbird 3′s final release.

This alpha release is primarily intended to let Thunderbird fans know that the project is alive and well and the team is working hard on the next version of the open source e-mail client. It’s also the first product to emerge from the newest entity within the Mozilla organization, Mozilla Messaging. The company was spun off this past winter in order to give more attention to the Thunderbird project, which had long lived under the shadow of the much more successful Firefox browser.

The feature set looks promising. However, one the most anticipated features of Thunderbird 3 – integration with Lightning, an extension that adds calendar functionality – isn’t available yet.

Continue Reading “Catch a Glimpse of Mozilla’s E-Mail Future in Thunderbird 3 Alpha 1″ »

File Under: Software & Tools

Dreamhost Discontinues Procmail Support

DreamhostDreamhost hosts over half a million domains, luring customers with cheap rates and acres of storage and bandwidth. They’ve also been historically pretty good in terms of using open tools and standards. Amid tales of web hosts being miscellaneously annoying and prohibiting basic tools like ssh, Dreamhost always seemed like a decent option. (I myself have never been their customer.)

In January they lost a lot of friends when they mis-billed their customer base, then added insult to injury with an overly irreverent apology.

More upsetting to me is the host’s recent decision to make Procmail, the classic and powerful mail-filtering tool, unavailable to users, after providing it for years.

Continue Reading “Dreamhost Discontinues Procmail Support” »

File Under: Software & Tools

Yahoo Unlimited Mail Fills Up


The Wall Street Journal’s tech blog reports trouble with Yahoo mail. Namely, it seems that keeping several years’ worth of e-mail in a Yahoo “unlimited” inbox causes a nasty error and the vanishing of all that mail.

Thanks to the Journal’s high profile, a fix is now expected in “a month or so.”

Last I heard, which was not terribly recently, Yahoo was running a modified version of Qmail as their back-end. (Please correct me if there’s more recent information.)

Continue Reading “Yahoo Unlimited Mail Fills Up” »

File Under: Software & Tools

Poll: What Do You Use to File Your E-mail?

SortingI’m grappling with this question myself. Not the more personal question of what particular categories you choose, but the logistical one of, having chosen them, how do you get the incoming mail into the right place?

Perhaps predictably for me, a notorious centralizer of data, I do my filtering on my mail server. I’m currently in the process of migrating from Procmail to Sieve to do that job. I’ll let you all know how it goes.

The Gmail-driven rage for sorting with labels rather than folders is cool if that’s what you’re into; personally I like folders’ hierarchical nature, allowing me to have subsets and subsubsets of my mail.

Continue Reading “Poll: What Do You Use to File Your E-mail?” »

File Under: Software & Tools

Alpine Turns It Up to 1.10

Alpine_2Alpine, the open-source-licensed successor to Pine, released its first post-v1 upgrade on Monday. You may recall Pine from your first shell account, or from jokes about prehistoric e-mail, but it continues to thrive in its new incarnation. Like Pine, Alpine runs in a terminal window, but even in 2008 it has its fans.

Its killer features include massive configurability, exquisite IMAP support (the IMAP developer community and the Alpine developer community overlap significantly), aggregate commands, and the quick non-GUI interface everyone loves. Remotely-stored configuration files and address books mean you can set your favorite settings once and then use them anywhere.

Continue Reading “Alpine Turns It Up to 1.10″ »

File Under: Software & Tools

Alpine E-Mail Client Released — Don’t Call it a Comeback

Alpine
The computing and networking group at the University of Washington has released Alpine, an open-source e-mail client for the desktop and the web. It’s based on Pine, the ancient but rock solid text-based e-mail client also developed at UW.

You may remember Pine from your school’s computer lab, your dad’s old Windows 3.1 box or (if you’re like Epicenter’s Dylan Tweney) from when you last checked your mail. Though it’s been the choice of Unix power users for almost two decades, Pine is also remarkably easy to use and simple enough for just about anyone to pick up.

Continue Reading “Alpine E-Mail Client Released — Don’t Call it a Comeback” »

File Under: Software & Tools

Boxbe Creates a VIP Guest List For Your Inbox

boxbe.jpg

The recently relaunched Boxbe has unveiled a new e-mail spam fighting service. Borrowing some ideas from IM and social networking, Boxbe adds a privilege system to your inbox which allows you to create an e-mail "friends list," much like those on social sites. It’s designed to help narrow down your e-mail workflow so you can focus more closely on the people who matter to you.

Of course the biggest danger in battening down your e-mail hatches is that important messages won’t get through, but to get around that Boxbe has a few tricks up its sleeve.

There’s no need to change e-mail addresses to use the service. Boxbe works as a plug-in, adding its spam-fighting features right in your Yahoo Mail account or within Outlook. Plug-ins for Gmail, Apple Mail and other popular e-mail programs are expected soon.

Continue Reading “Boxbe Creates a VIP Guest List For Your Inbox” »

File Under: Software & Tools

How To: Store Messages Sent With Gmail on Another Mail Server

gmailscript.jpgPart of Gmail’s popularity lies in its plethora of options. Even if it isn’t your primary e-mail address, options like the ability to set multiple “from” addresses make it an easy way to manage all your mail accounts in one place.

But there’s one flaw in that solution: if you send mail from Gmail using a non-Gmail address, there’s no copy of the sent message stored in your primary e-mail account, which is why the GmailAutoBcc Greasemonkey script is incredibly handy.

The simple script automatically BCCs a selected address so you can keep copies of sent messages on your primary mail server even when you send them through Gmail.

Continue Reading “How To: Store Messages Sent With Gmail on Another Mail Server” »