Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP

Farzad Jahanshir
Farzad Jahanshir
5,317 Points

Using A Third-Party Library, Build a Simple PHP Application

$mail->ValidateAddress($email); does't check the email address properly. just go to http://www.shirts4mike.com/contact.php and input a@b in the email field. It will be as a valid email address recognized!

2 Answers

Kevin Korte
Kevin Korte
28,109 Points

You're right. It's not a good way to validate an email address. If I remember correctly, they also explained that. This course is at it's core a beginners course. Validating email addresses, can be tricky. This introduces you to the idea of using a plugin to validate more complex inputs like emails, phones, or CC numbers. If you can start to understand how to implement a plugin, even in the most simplest form, you should start to be able to figure out how use a better option.

If I remember correctly, the only validation it's looking for is that there is an @ symbol, and it's not the first or last character.

Farzad Jahanshir
Farzad Jahanshir
5,317 Points

better test option for email: abc@abc

James Barnett
James Barnett
39,199 Points

Validating an email address is surprisingly hard, you can read about the challenges here and here

The best option is to use verimail.js