title: Heroku, Django, and Sendgrid - emails not sending?
body: <p>So I'm using heroku and sendgrid and think I have my settings.py configured correctly:</p>
  
  <pre><code>EMAIL_HOST_USER = os.environ['SENDGRID_USERNAME']
  EMAIL_HOST= 'smtp.sendgrid.net'
  EMAIL_PORT = 587
  EMAIL_USE_TLS = True
  EMAIL_HOST_PASSWORD = os.environ['SENDGRID_PASSWORD']
  </code></pre>
  
  <p>I'm sending email using send_mail like this (using pre_save receiver to check if attribute has changed... also 'myemail@gmail.com' is replaced with my actual email):</p>
  
  <pre><code>@receiver(pre_save,sender=LotteryEntry)
  def send_email_if_invited(sender,instance,**kwargs):
      try:
          obj = LotteryEntry.objects.get(pk=instance.pk)
      except LotteryEntry.DoesNotExist:
          #could send email here telling them when they should know
          pass
      else:
          if not obj.invited == instance.invited:
              l = Dinner.objects.get(id=instance.dinner.id)
              u = User.objects.get(id=instance.user.id)
              message = "You have been chosen to attend %s! Here is the description of the event: %s. We will see you there!" % (l.title,l.description)
              send_mail('You have been invited!',message,'myemail@gmail.com',[u.email],fail_silently=False)
  </code></pre>
  
  <p>The logs show that it is being sent.. but I'm not receiving it in my inbox nor does the sendgrid addon account section say I have sent emails. Anyone have this problem before?</p>
  
  <p>Edit:</p>
  
  <p>Here are my imports of settings.py</p>
  
  <pre><code>import os
  import sys
  </code></pre>
  
  <p>And my models file (where send_mail happens):</p>
  
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  from django.db.models.signals import *
  from django.dispatch import receiver
  from django.core.mail import send_mail
  </code></pre>
  
  <p>And here is a log of the send_mail call:</p>
  
  <pre><code>Content-Type: text/plain; charset="utf-8"
  2012-05-28T21:16:49+00:00 app[web.1]: MIME-Version: 1.0
  2012-05-28T21:16:49+00:00 app[web.1]: Content-Transfer-Encoding: quoted-printable
  2012-05-28T21:16:49+00:00 app[web.1]: Subject: You have been invited!
  2012-05-28T21:16:49+00:00 app[web.1]: From: msencenb@stanford.edu
  2012-05-28T21:16:49+00:00 app[web.1]: To: msencenb@stanford.edu
  2012-05-28T21:16:49+00:00 app[web.1]: Date: Mon, 28 May 2012 21:16:49 -0000
  2012-05-28T21:16:49+00:00 app[web.1]: Message-ID: &lt;20120528211649.1.49209@2a33c2a2-9b5e-4da9-994c-15de8157702e&gt;
  2012-05-28T21:16:49+00:00 app[web.1]: 
  2012-05-28T21:16:49+00:00 app[web.1]: You have been chosen to attend Web Development Pt. 1! Here is the descripti=
  2012-05-28T21:16:49+00:00 app[web.1]: on of the event: Knight Management Center, 5/23/12 12:30 to 2 PM. We will s=
  2012-05-28T21:16:49+00:00 app[web.1]: ee you there!
  2012-05-28T21:16:49+00:00 app[web.1]: -------------------------------------------------------------------------------
  2012-05-28T21:16:49+00:00 app[web.1]: [28/May/2012 16:16:49] "POST /admin/dinners/lotteryentry/1/ HTTP/1.1" 302 0
  2012-05-28T21:16:49+00:00 heroku[router]: POST morning-frost-2949.herokuapp.com/admin/dinners/lotteryentry/1/ dyno=web.1 queue=0 wait=0ms service=107ms status=302 bytes=0
  </code></pre>