title: Rails 5.2 Net::SMTPAuthenticationError - 535 Authentication failed: account disabled When Sending Email (Localhost and Heroku)
body: <p>I'm trying to get a Rails 5.2 mailer working, but am coming across a <code>Net::SMTPAuthenticationError - 535 Authentication failed: account disabled</code> error on both <code>localhost</code> and my Heroku <code>production</code> environment.</p>
  
  <p>The mailer looks like this:</p>
  
  <pre><code>class AdminNotificationsMailer &lt; ApplicationMailer
    default from: "liz@linchpinindustries.com"
  
    def new_rfp(rfp)
      @rfp = rfp
      mail(
        :to =&gt; "liz@linchpinindustries.com",
        :subject =&gt; 'New RFP Alert!'
      )
    end
  
    def new_contact_us(contact)
      @contact = contact
      mail(
        to: "liz@linchpinindustries.com",
        subject: 'New Contact Us Submission on LPI'
      )
    end
  
  end
  </code></pre>
  
  <p>With the trigger in my <code>rfp#create action</code> (for the first mailer, the <code>new_rfp</code> one):</p>
  
  <pre><code>def create
      @rfp = Rfp.new(rfp_params)
  
      respond_to do |format|
        if @rfp.save!
          AdminNotificationsMailer.new_rfp(@rfp).deliver
          format.html { redirect_to root_path, notice: "Thanks for your request!  We'll get back to you ASAP.  Stay tuned!" }
          format.json { render :show, status: :created, location: @rfp }
        else
          format.html { render :new }
          format.json { render json: @rfp.errors, status: :unprocessable_entity }
        end
      end
    end
  </code></pre>
  
  <p>I have provisioned Sendgrid and double checked my username and password with <code>puts</code> (it is correct on localhost and production).</p>
  
  <p>I have the following in my <code>environment.rb</code>:</p>
  
  <pre><code>ActionMailer::Base.smtp_settings = {
    :user_name =&gt; ENV["SENDGRID_USERNAME"],
    :password =&gt; ENV["SENDGRID_PASSWORD"],
    :domain =&gt; 'linchpinindustries.com',
    :address =&gt; 'smtp.sendgrid.net',
    :port =&gt; 587,
    :authentication =&gt; :plain,
    :enable_starttls_auto =&gt; true
  }
  </code></pre>
  
  <p>I've consulted posts like <a href="https://stackoverflow.com/questions/28472490/rails-netsmtpauthenticationerror-535-authentication-failed-bad-username">this</a> and <a href="https://stackoverflow.com/questions/30226176/ruby-on-rails-bad-username-password-535-auth-failed/30227214">this</a>, but nothing is working.</p>
  
  <p>I'm officially stumped.  Can anyone see why this error is occurring?</p>