title: Checking validity of email in django/python
body: <p>I have written a function for adding emails to newsletter base. Until I've added checking validity of sent email it was working flawlessly. Now each time I'm getting "Wrong email" in return. Can anybody see any errors here ? The regex used is :</p>
  
  <p><code>\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b</code> and it is 100% valid (<a href="http://gskinner.com/RegExr/" rel="noreferrer">http://gskinner.com/RegExr/</a>), but I may be using it wrong, or it may be some logic error :</p>
  
  <pre><code>def newsletter_add(request):
      if request.method == "POST":   
          try:
              e = NewsletterEmails.objects.get(email = request.POST['email'])
              message = _(u"Email is already added.")
              type = "error"
          except NewsletterEmails.DoesNotExist:
              if validateEmail(request.POST['email']):
                  try:
                      e = NewsletterEmails(email = request.POST['email'])
                  except DoesNotExist:
                      pass
                  message = _(u"Email added.")
                  type = "success"
                  e.save()
              else:
                  message = _(u"Wrong email")
                  type = "error"
  
  import re
  
  def validateEmail(email):
      if len(email) &gt; 6:
          if re.match('\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b', email) != None:
              return 1
      return 0
  </code></pre>