Discussion on:

5
Comments

Join the conversation!

Follow via:
RSS
Email Alert
0 Votes
+ -
Editor
The download version of this article is available here:
http://techrepublic.com.com/5138-3513-5951488.html

Validating user-supplied information like e-mail addresses should be common best practice. Does your Web site validate users?

Why not? confused
The + sign is also valid in an email address. Email servers are supposed to ignore the + and any alphanumerics between the + and the @ characters. For example, if I sign up for a newsletter I might use: myname+somewebsite@gmail.com. Then I can track if "somewebsite" gives my email address to others.

FYI, on my website, in addition to using a regexp, I have lightly hacked Moveable Type to verify that the domain name of a commenter's email address resolves.

--Jim Service (www.hubbo.com)
0 Votes
+ -
I validate email addresses using a combination of PHP's regex functions and checkdnsrr. Readers should also note that if the input is used to send email, regex to screen for newlines and/or "Bcc:" should be used to prevent the form from being used to send SPAM
0 Votes
+ -
Before doing checkdnsrr, you can check the address against gTLDs and ccTLDs to weed out obvious rejects.
This is fine for domain.tld but additional processing is needed to account for addresses from domains such as mail.mycompany.com or mail.yourcompany.co.uk
Keyboard Shortcuts:
Prev
Next
Toggle
Join the conversation
Formatting +
BB Codes - Note: HTML is not supported in forums
  • [b] Bold [/b]
  • [i] Italic [/i]
  • [u] Underline [/u]
  • [s] Strikethrough [/s]
  • [q] "Quote" [/q]
  • [ol][*] 1. Ordered List [/ol]
  • [ul][*] · Unordered List [/ul]
  • [pre] Preformat [/pre]
  • [quote] "Blockquote" [/quote]

Join the TechRepublic Community and join the conversation! Signing-up is free and quick, Do it now, we want to hear your opinion.