title: Django email sending on Heroku
body: <p>Here is my properties in settings.py file:</p>
  
  <pre><code>EMAIL_USE_TLS = True
  EMAIL_HOST = 'smtp.gmail.com'
  EMAIL_HOST_USER = 'infobot9@gmail.com'
  EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD')
  EMAIL_PORT = 587
  </code></pre>
  
  <p>and here is my send email method:</p>
  
  <pre><code>from django.core.mail import send_mail 
  
  
  def sendConfirmEmail(email, instance, code):
      mail_subject = 'Confirmation code {}'.format(code)
      message = render_to_string("msg.html", {
         'user': instance,
         'code': code
  
      })
      to_email = email
      send_mail(mail_subject, message, 'infobot9@gmail.com', [to_email], 
                fail_silently=False)
  </code></pre>
  
  <p>My Django email sending methods work fine in my local host. After deploying it to Heroku I have allowed the login from unknown devices in my Gmail settings. Gmail does not allow the server login to my account and sends me a message:</p>
  
  <p>spicious login attempt blocked</p>
  
  <p>￼infobot9@gmail.com</p>
  
  <p>Someone tried to log into your account using the password set for them. If it was not you, we recommend that you change your password as soon as possible.</p>
  
  <p></p>
  
  <p>Unknown Device</p>
  
  <p></p>
  
  <p>April 4, 11:39</p>
  
  <p></p>
  
  <p>Near this place: Dublin, Ireland</p>
  
  <p>176.34.163.6 (IP address)</p>
  
  <p>Should I set extra parameters in my <code>settings.py</code> file or I need change my Gmail account settings?</p>