Permalink
Browse files

[FIX] Check Validation Email

  • Loading branch information...
1 parent c55253e commit 68ba89b6f1ae5c7aa7c8a0c601bb660e9c353fe0 resteve committed Dec 21, 2011
Showing with 4 additions and 6 deletions.
  1. +4 −6 poweremail_mailbox.py
View
10 poweremail_mailbox.py
@@ -31,6 +31,8 @@
from tools.translate import _
import tools
+import re
+
LOGGER = netsvc.Logger()
class PoweremailMailbox(osv.osv):
@@ -163,12 +165,8 @@ def check_email_valid(self, email):
return True/False
"""
def get_validate_email(email):
- sep=[x for x in email if not x.isalpha()]
- sepjoined=''.join(sep)
- if sepjoined.strip('.') != '@': return False
- for i in sep:
- part,i,email=email.partition(i)
- if len(part)<2: return False
+ if not re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", email):
+ return False
return True
if not email:

0 comments on commit 68ba89b

Please sign in to comment.