Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Validação de Email

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Portuguese
View previous topic :: View next topic  
Author Message
temonteiro
Smarty n00b


Joined: 09 Jun 2010
Posts: 1

PostPosted: Thu Aug 19, 2010 2:07 pm    Post subject: Validação de Email Reply with quote

Oi gente,
Vocês conhecem uma maneira de validar um email(verificar se ele foi escrito da maneira correta) usando Smarty?
Back to top
View user's profile Send private message
Zeca_JP
Smarty n00b


Joined: 23 Oct 2013
Posts: 1

PostPosted: Wed Oct 23, 2013 11:43 am    Post subject: e aí.. Reply with quote

Bom.....eu uso essa função no php mesmo...nunca tive problema, funciona de boa..

Code:

/*****************************
VALIDA O EMAIL
*****************************/   
   
   function valMail($email){
      if(preg_match('/[a-z0-9_\.\-]+@[a-z0-9_\.\-]*[a-z0-9_\.\-]+\.[a-z]{2,4}$/',$email)){
         return true;
      }else{
         return false;
      }
   }


espero ter ajudado..um abraço.
Back to top
View user's profile Send private message
migas
Smarty Regular


Joined: 07 Apr 2004
Posts: 73
Location: Porto, Portugal

PostPosted: Fri Jun 12, 2015 10:43 am    Post subject: Reply with quote

A melhor solução é usar o "próprio" php para validar.

http://php.net/manual/en/filter.examples.validation.php

Code:

<?php
$email_a = 'joe@example.com';
$email_b = 'bogus';

if (filter_var($email_a, FILTER_VALIDATE_EMAIL)) {
    echo "This ($email_a) email address is considered valid.";
}
if (filter_var($email_b, FILTER_VALIDATE_EMAIL)) {
    echo "This ($email_b) email address is considered valid.";
}
?>
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Portuguese All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP