I am attempting to use the function valid_email_address to validate email addresses before a "Send to a Friend" email is sent out. Everything seemed to have been working great. If I typed in a bad email address in the "Your Email" or the "Friends Email" it wouldn't send out. If I typed in valid email addresses it would send out without a hitch. Great! I thought it works perfectly.

Except:

If I type in an email address like example@domain and omit the .net, .com or .org the function returns TRUE and says that it sent the email, which it obviously did not do. I decided since I was using this function outside of normal usage that I'd check everything over a few times in my own code. When I did so I realized everything was fine, so I visited ?q=admin/user/user/create on my site registered as user with an email address of example@domain with no problem.

I would think that if a user omits the domain extension off the end of the email address, when that email address reaches the valid_email_address function it should return FALSE. In my case this would result in the "Send to a Friend" email not being sent.

This seems as though it could create problems for sites that allow users to register their own accounts.

Thank you,

Josh

Comments

stevenpatz’s picture

Status: Active » Closed (works as designed)

I believe that according to RFC 2822 example@domain is valid.