I am coding a site in php and I am currently on the contact us page and I was wondering what was the best way to validate an email address?
Also could you tell me why and a guide along my way to achieving it? I dont want someone to do the code for me because thats no fun for me and I won't learn but just some guidance on the techniques used to achieve either the methods above.
Also I am going to use these methods to implement a subscribe button on my webpage. Is this the best way to do this? any other methods I should condsider?
I usually go through these steps
if the first step fails it never reaches second step. if the email sending fails because the email doesn't exist I delete the account or do some other stuff
--edit
3 - If for some reason the activation email doesn't get sent, email doesn't get deleted, it stays unapproved for 7 days (or as configured by you), email resending is tried in every 2-3 hours, after those days if no success, email is deleted
4 - If email sent successfully but not activated it stays unapproved but can be reactivated anytime by generating a new activation code
I think the best is a combination of 3. and 1.
In an initial phase you verify syntactically the e-mail (to catch typos):
filter_var($email, FILTER_VALIDATE_EMAIL)
And in a second one you send an e-mail with a confirmation address (to both catch errors and deliberately wrong information).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With