title: PayPal IPN Send Email
body: <p>I have a controller that handles PayPal's IPN callback. I want to mark an attendee as 'paid' and send them a confirmation email if they've successfully paid.</p>
  
  <p>The mark paid action is working but the email is not sending.</p>
  
  <p>Here's my controller:</p>
  
  <pre><code>    class PaymentNotificationsController &lt; ApplicationController
        protect_from_forgery :except =&gt; [:create]
  
        def create
          PaymentNotification.create!(:params =&gt; params, :attendee_id =&gt; params[:invoice],  :status =&gt; params[:payment_status], :transaction_id =&gt; params[:txn_id])
          if params[:payment_status] == 'Complete'
            @attendee = Attendee.find(params[:invoice])
            ## Working
            @attendee.update_attribute(:paid, Time.now)
            ## Not Working
            UserMailer.welcome_email(@attendee).deliver
          end
          render nothing: true
        end
      end
  </code></pre>
  
  <p>Here's my user_mailer file:</p>
  
  <pre><code>    class UserMailer &lt; ActionMailer::Base
        default from: 'example@email.com'
  
        def welcome_email(user)
          @user = user
          email_with_name = "#{@user.first_name} #{@user.last_name} &lt;#{@user.email}&gt;"
          @url  = 'http://example.com'
          mail(
            to: email_with_name,
            subject: 'Welcome to Yadda Yadda'
          )
        end
      end
  </code></pre>
  
  <p>Here's the weird thing, in another controller that doesn't have PayPal the mailer works:</p>
  
  <pre><code>    class VendorsController &lt; ApplicationController
        def create
          @vendor = Vendor.new(vendor_params)
          if @vendor.save
            UserMailer.welcome_email(@vendor).deliver
            redirect_to vendor_success_path
          else
            render 'new'
          end
         end
       end
  </code></pre>