This is a common rails mailer issue and bug new programmers,

Net::SMTPAuthenticationError in InviteController#send_email_invites

530 5.7.0 Must issue a STARTTLS command first. u10sm46215072pbr.12

the solution of this problem is to include following settings in your environment.rb file

config/environments/development.rb
-----------------------------------
    require 'tlsmail' #key but not always described
    Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)   
    ActionMailer::Base.delivery_method = :smtp
    ActionMailer::Base.perform_deliveries = true
    ActionMailer::Base.raise_delivery_errors = true
   
    ActionMailer::Base.smtp_settings = {
      :enable_starttls_auto => true,  #this is the important part!
      :address        => 'smtp.gmail.com',
      :port           => 587,
      :domain         => 'xtargets.com',
      :authentication => :plain,
      :user_name      => '-------',
      :password       => '-------'
    }
   
Rails ActionMailer STARTTLS bug solution

Leave a Reply

Your email address will not be published.