title: How to set Timeout for sending email using django?
body: <p>I'm trying to set a timeout for sending email with Django. I'm using django 1.7.3 and python v2.7.6. My aproach was follow the django documentation in <a href="https://docs.djangoproject.com/en/1.7/topics/email/#smtp-backend" rel="nofollow">here</a>. So what i did was create a custom email backend by creating a file named myemailbackend.py on django/core/mail/backends folder with the following code: </p>
  
  <pre><code>from django.core.mail.backends import smtp
  
  class MyEmailBackend(smtp.EmailBackend):
    def __init__(self, *args, **kwargs):
        kwargs.setdefault('timeout', 3) #this is 3 secs, i believe.
        super(MyEmailBackend, self).__init__(*args, **kwargs)
  </code></pre>
  
  <p>After that in my settings.py i set my EMAIL_BACKEND:</p>
  
  <pre><code># Email setup
  
  EMAIL_BACKEND = 'django.core.mail.backends.base.myemailbackend'
  EMAIL_USE_TLS = True
  EMAIL_HOST = 'smtp.gmail.com'
  EMAIL_HOST_USER = 'xxxx@gmail.com'
  EMAIL_HOST_PASSWORD = 'xxx'
  EMAIL_PORT = 587
  # EMAIL_TIMEOUT = 3  # 3 sec, this would be great but i notice that this is not possible since that backend stmp.py doesn't expect to get "EMAIL_TIMEOUT" var.
  </code></pre>
  
  <p>After i runserver i've noticed that this doesn't seem to work, i notice to that myemailbackend.py didn't was compile.
  What am i'm missing? How can i set a timeout for send email, afterall?</p>