title: Sendgrid not sending email?
body: <p>I am trying to implement sendgrid into my backend api rails system so that when a user signs up I can send them a welcome email. After making a post request and handling user creation, I get this verification:</p>
  
  <pre><code>UserMailer#send_sign_up_email: processed outbound mail in 43.5ms
  Sent mail to *******@gmail.com (185.8ms)
  Date: Wed, 28 Feb 2018 16:54:05 -0800
  From: *******@gmail.com
  To: *******@gmail.com
  Message-ID: &lt;5a974f2d39c92_c5b2abcd76769fc423e0@albert-VirtualBox.mail&gt;
  Subject: Welcome to BottlesTonight albert jin!
  Mime-Version: 1.0
  Content-Type: text/html;
   charset=UTF-8
  Content-Transfer-Encoding: quoted-printable
  </code></pre>
  
  <p>My code looks exactly like in this link <a href="https://sendgrid.com/docs/Integrate/Frameworks/rubyonrails.html" rel="nofollow noreferrer">https://sendgrid.com/docs/Integrate/Frameworks/rubyonrails.html</a>.</p>
  
  <p>This looks all fine and well, but the email is just not sending (I put stars here for the email but I actually put in my email, and I used another one of emails as the default for sending). There is no email in my outbox or inbox.  </p>
  
  <p>However, now that I think about it, I never "logged in" with my email or entered the password, so the application shouldn't have access to send emails with my email. I also never did anything with the api key that I made on my sendgrid account. Furthermore, for the environment.rb file, I wasn't sure what to put in domain, so I put gmail.com. These all seem kinda sketchy to me, I think the tutorial doesn't contain everything. Does anyone know how to configure this? I've been stuck on it for a while.</p>
  
  <p>Edit:
  I tried doing it on production and it is not working. Here is more info:
  My production.rb looks like this:</p>
  
  <pre><code>config.action_mailer.raise_delivery_errors = true
    config.action_mailer.delivery_method = :smtp
  
    config.action_mailer.default_url_options = { :host =&gt; ENV['DEFAULT_HOST'] }
  
    ActionMailer::Base.smtp_settings = {
      :address        =&gt; 'smtp.sendgrid.net',
      :port           =&gt; '587',
      :authentication =&gt; :plain,
      :user_name      =&gt; ENV['SENDGRID_USERNAME'],
      :password       =&gt; ENV['SENDGRID_PASSWORD'],
      :domain         =&gt; 'heroku.com',
      :enable_starttls_auto =&gt; true
    }
  </code></pre>
  
  <p>I have a heroku sendgrid add on. I have set the heroku config vars. In my registrations controller I merely added the line:</p>
  
  <pre><code>UserMailer.send_sign_up_email(@current_user).deliver
  </code></pre>
  
  <p>My mailer class looks like:</p>
  
  <pre><code>def send_sign_up_email(user)
     @user = user
     mail(to: @user.email, subject: "Welcome! #{@user.first_name}")
     end
  </code></pre>
  
  <p>However, when I sign up on my website, the user gets added to the database but the email is not sending. Does anyone know why, or how I can debug?</p>