Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,148 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