Rails devise with gmail errorsA concise explanation of nil v. empty v. blank in Ruby on RailsUnderstanding the Rails Authenticity TokenHow can I rename a database column in a Ruby on Rails migration?How do I get the current absolute URL in Ruby on Rails?Devise Not Sending MailNo route matches “/users/sign_out” devise rails 3Rails Mailer is not actually sending emailsAngular Rails Devise Override Controller1 error prohibited this user from being saved: Reset password token is invalidRails w/devise authentication what is the configuration of iRedMail?

Marrying a second woman behind your wife's back: is it wrong and can Quran/Hadith prove this?

How acidic does a mixture have to be for milk to curdle?

How can I create a pattern of parallel lines that are increasing in distance in Photoshop / Illustrator?

What is the difference between 1/3, 1/2, and full casters?

Why are so many countries still in the Commonwealth?

Can the 2019 UA Artificer's Returning Weapon and Radiant Weapon infusions stack on the same weapon?

Convert a string like 4h53m12s to a total number of seconds in JavaScript

Why was Sauron preparing for war instead of trying to find the ring?

kids pooling money for Lego League and taxes

What is "I bet" in German?

How do I generate distribution of positive numbers only with min, max and mean?

Trapped in an ocean Temple in Minecraft?

Send a single HTML email from Thunderbird, overriding the default "plain text" setting

How to deal with a player who makes bad characters and kills them?

Print sums of all subsets

Spin vs orbital angular momenta in QFT

Giant space birds hatching out of planets; short story

Why didn't Britain or any other European power colonise Abyssinia/Ethiopia before 1936?

How to judge a Ph.D. applicant that arrives "out of thin air"

Is it normal practice to screen share with a client?

Keeping an "hot eyeball planet" wet

How do I stop my characters falling in love?

Can two figures have the same area, perimeter, and same number of segments have different shape?

What does コテッと mean?



Rails devise with gmail errors


A concise explanation of nil v. empty v. blank in Ruby on RailsUnderstanding the Rails Authenticity TokenHow can I rename a database column in a Ruby on Rails migration?How do I get the current absolute URL in Ruby on Rails?Devise Not Sending MailNo route matches “/users/sign_out” devise rails 3Rails Mailer is not actually sending emailsAngular Rails Devise Override Controller1 error prohibited this user from being saved: Reset password token is invalidRails w/devise authentication what is the configuration of iRedMail?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I'm currently working on an application with a mailer system. It was working fine, sending a welcome email and sending instructions to reset password, but now and only when I try to send reset instructions I have this error.



ArgumentError (SMTP From address may not be blank: nil):


I'm using a custom domain like so noreply@mycustomdomain.com
And here is my configuration



development.rb



 config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = host: 'localhost:3000'

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings =
address: 'smtp.gmail.com',
port: '587',
domain: 'gmail.com',
authentication: :plain,
enable_starttls_auto: true,
user_name: Rails.application.secrets.mailer_username,
password: Rails.application.secrets.mailer_password



Any idea ?



Edit



class UserMailer < ApplicationMailer
default from: 'noreply@mycustomdomain.com'

def welcome_email(user)
@user = user
@url = 'http://localhost:3000/users/sign_in'
mail(to: @user.email, subject: 'Bienvenue')
end

def generate_new_password_email
user = User.find(params[:user_id])
user.send_reset_password_instructions
end

def reset_password; end
end









share|improve this question






























    2















    I'm currently working on an application with a mailer system. It was working fine, sending a welcome email and sending instructions to reset password, but now and only when I try to send reset instructions I have this error.



    ArgumentError (SMTP From address may not be blank: nil):


    I'm using a custom domain like so noreply@mycustomdomain.com
    And here is my configuration



    development.rb



     config.action_mailer.raise_delivery_errors = true
    config.action_mailer.perform_caching = false
    config.action_mailer.default_url_options = host: 'localhost:3000'

    config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings =
    address: 'smtp.gmail.com',
    port: '587',
    domain: 'gmail.com',
    authentication: :plain,
    enable_starttls_auto: true,
    user_name: Rails.application.secrets.mailer_username,
    password: Rails.application.secrets.mailer_password



    Any idea ?



    Edit



    class UserMailer < ApplicationMailer
    default from: 'noreply@mycustomdomain.com'

    def welcome_email(user)
    @user = user
    @url = 'http://localhost:3000/users/sign_in'
    mail(to: @user.email, subject: 'Bienvenue')
    end

    def generate_new_password_email
    user = User.find(params[:user_id])
    user.send_reset_password_instructions
    end

    def reset_password; end
    end









    share|improve this question


























      2












      2








      2








      I'm currently working on an application with a mailer system. It was working fine, sending a welcome email and sending instructions to reset password, but now and only when I try to send reset instructions I have this error.



      ArgumentError (SMTP From address may not be blank: nil):


      I'm using a custom domain like so noreply@mycustomdomain.com
      And here is my configuration



      development.rb



       config.action_mailer.raise_delivery_errors = true
      config.action_mailer.perform_caching = false
      config.action_mailer.default_url_options = host: 'localhost:3000'

      config.action_mailer.delivery_method = :smtp
      config.action_mailer.smtp_settings =
      address: 'smtp.gmail.com',
      port: '587',
      domain: 'gmail.com',
      authentication: :plain,
      enable_starttls_auto: true,
      user_name: Rails.application.secrets.mailer_username,
      password: Rails.application.secrets.mailer_password



      Any idea ?



      Edit



      class UserMailer < ApplicationMailer
      default from: 'noreply@mycustomdomain.com'

      def welcome_email(user)
      @user = user
      @url = 'http://localhost:3000/users/sign_in'
      mail(to: @user.email, subject: 'Bienvenue')
      end

      def generate_new_password_email
      user = User.find(params[:user_id])
      user.send_reset_password_instructions
      end

      def reset_password; end
      end









      share|improve this question
















      I'm currently working on an application with a mailer system. It was working fine, sending a welcome email and sending instructions to reset password, but now and only when I try to send reset instructions I have this error.



      ArgumentError (SMTP From address may not be blank: nil):


      I'm using a custom domain like so noreply@mycustomdomain.com
      And here is my configuration



      development.rb



       config.action_mailer.raise_delivery_errors = true
      config.action_mailer.perform_caching = false
      config.action_mailer.default_url_options = host: 'localhost:3000'

      config.action_mailer.delivery_method = :smtp
      config.action_mailer.smtp_settings =
      address: 'smtp.gmail.com',
      port: '587',
      domain: 'gmail.com',
      authentication: :plain,
      enable_starttls_auto: true,
      user_name: Rails.application.secrets.mailer_username,
      password: Rails.application.secrets.mailer_password



      Any idea ?



      Edit



      class UserMailer < ApplicationMailer
      default from: 'noreply@mycustomdomain.com'

      def welcome_email(user)
      @user = user
      @url = 'http://localhost:3000/users/sign_in'
      mail(to: @user.email, subject: 'Bienvenue')
      end

      def generate_new_password_email
      user = User.find(params[:user_id])
      user.send_reset_password_instructions
      end

      def reset_password; end
      end






      ruby-on-rails devise actionmailer






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 11 '17 at 8:07







      Manspider

















      asked Jul 10 '17 at 14:19









      ManspiderManspider

      1151 silver badge12 bronze badges




      1151 silver badge12 bronze badges






















          5 Answers
          5






          active

          oldest

          votes


















          1














          I had the same problem, and the reason behind that was i working in development but my mailer was searching the smtp_settings in the production, so to solve the issue you can change the mailer settings or you can copy the same smtp_settings into production.






          share|improve this answer























          • Pretty much how I fixed it if I remember correctly

            – Manspider
            Mar 23 '18 at 0:50


















          3














          In devise.rb config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' had been commented.
          Config.mailer_sender was never initialized and so always nil even if I set it with default from:






          share|improve this answer






























            2














            It looks like you don't have a From header in your email. A good practice would be to put the following line into your ApplicationMailer:



            class ApplicationMailer
            default from: 'noreply@mycustomdomain.com'

            # ...
            end


            To override this in your inheriting mailers, simply declare the same statement. To override it in individual mail methods, put it into the mail call like so:



            def new_message(user, message)
            mail(
            to: user.email,
            subject: "New message from #message.sender.name",
            from: message.sender.email
            )
            end


            Hope that helps






            share|improve this answer























            • I do have a default from set to the correct address in my mailer. Also the mail is send by Devise as it is a mail to reset a password. It worked for a time without having to override anything so the problem is somewhere else maybe.

              – Manspider
              Jul 11 '17 at 7:50











            • @LRP it's in devise.rb. Need something like this: config.mailer_sender = ENV['SMTP_USERNAME']

              – Ka Mok
              Jan 23 '18 at 5:14


















            2














            You could try setting :from in your config, using the default_option like this,



            config.action_mailer.default_options = from: 'noreply@mycustomdomain.com' 





            share|improve this answer

























            • this is 10 months old

              – Manspider
              May 31 '18 at 6:00


















            0














            I stumbled upon the same problem. My solution was, I edited config/initializers/devise.rb changed a line from config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
            to config.mailer_sender = ENV["default_from_email"]






            share|improve this answer

























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45014520%2frails-devise-with-gmail-errors%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              5 Answers
              5






              active

              oldest

              votes








              5 Answers
              5






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              I had the same problem, and the reason behind that was i working in development but my mailer was searching the smtp_settings in the production, so to solve the issue you can change the mailer settings or you can copy the same smtp_settings into production.






              share|improve this answer























              • Pretty much how I fixed it if I remember correctly

                – Manspider
                Mar 23 '18 at 0:50















              1














              I had the same problem, and the reason behind that was i working in development but my mailer was searching the smtp_settings in the production, so to solve the issue you can change the mailer settings or you can copy the same smtp_settings into production.






              share|improve this answer























              • Pretty much how I fixed it if I remember correctly

                – Manspider
                Mar 23 '18 at 0:50













              1












              1








              1







              I had the same problem, and the reason behind that was i working in development but my mailer was searching the smtp_settings in the production, so to solve the issue you can change the mailer settings or you can copy the same smtp_settings into production.






              share|improve this answer













              I had the same problem, and the reason behind that was i working in development but my mailer was searching the smtp_settings in the production, so to solve the issue you can change the mailer settings or you can copy the same smtp_settings into production.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Mar 22 '18 at 8:16









              Somesh SharmaSomesh Sharma

              1596 bronze badges




              1596 bronze badges












              • Pretty much how I fixed it if I remember correctly

                – Manspider
                Mar 23 '18 at 0:50

















              • Pretty much how I fixed it if I remember correctly

                – Manspider
                Mar 23 '18 at 0:50
















              Pretty much how I fixed it if I remember correctly

              – Manspider
              Mar 23 '18 at 0:50





              Pretty much how I fixed it if I remember correctly

              – Manspider
              Mar 23 '18 at 0:50













              3














              In devise.rb config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' had been commented.
              Config.mailer_sender was never initialized and so always nil even if I set it with default from:






              share|improve this answer



























                3














                In devise.rb config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' had been commented.
                Config.mailer_sender was never initialized and so always nil even if I set it with default from:






                share|improve this answer

























                  3












                  3








                  3







                  In devise.rb config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' had been commented.
                  Config.mailer_sender was never initialized and so always nil even if I set it with default from:






                  share|improve this answer













                  In devise.rb config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' had been commented.
                  Config.mailer_sender was never initialized and so always nil even if I set it with default from:







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 11 '17 at 8:40









                  ManspiderManspider

                  1151 silver badge12 bronze badges




                  1151 silver badge12 bronze badges





















                      2














                      It looks like you don't have a From header in your email. A good practice would be to put the following line into your ApplicationMailer:



                      class ApplicationMailer
                      default from: 'noreply@mycustomdomain.com'

                      # ...
                      end


                      To override this in your inheriting mailers, simply declare the same statement. To override it in individual mail methods, put it into the mail call like so:



                      def new_message(user, message)
                      mail(
                      to: user.email,
                      subject: "New message from #message.sender.name",
                      from: message.sender.email
                      )
                      end


                      Hope that helps






                      share|improve this answer























                      • I do have a default from set to the correct address in my mailer. Also the mail is send by Devise as it is a mail to reset a password. It worked for a time without having to override anything so the problem is somewhere else maybe.

                        – Manspider
                        Jul 11 '17 at 7:50











                      • @LRP it's in devise.rb. Need something like this: config.mailer_sender = ENV['SMTP_USERNAME']

                        – Ka Mok
                        Jan 23 '18 at 5:14















                      2














                      It looks like you don't have a From header in your email. A good practice would be to put the following line into your ApplicationMailer:



                      class ApplicationMailer
                      default from: 'noreply@mycustomdomain.com'

                      # ...
                      end


                      To override this in your inheriting mailers, simply declare the same statement. To override it in individual mail methods, put it into the mail call like so:



                      def new_message(user, message)
                      mail(
                      to: user.email,
                      subject: "New message from #message.sender.name",
                      from: message.sender.email
                      )
                      end


                      Hope that helps






                      share|improve this answer























                      • I do have a default from set to the correct address in my mailer. Also the mail is send by Devise as it is a mail to reset a password. It worked for a time without having to override anything so the problem is somewhere else maybe.

                        – Manspider
                        Jul 11 '17 at 7:50











                      • @LRP it's in devise.rb. Need something like this: config.mailer_sender = ENV['SMTP_USERNAME']

                        – Ka Mok
                        Jan 23 '18 at 5:14













                      2












                      2








                      2







                      It looks like you don't have a From header in your email. A good practice would be to put the following line into your ApplicationMailer:



                      class ApplicationMailer
                      default from: 'noreply@mycustomdomain.com'

                      # ...
                      end


                      To override this in your inheriting mailers, simply declare the same statement. To override it in individual mail methods, put it into the mail call like so:



                      def new_message(user, message)
                      mail(
                      to: user.email,
                      subject: "New message from #message.sender.name",
                      from: message.sender.email
                      )
                      end


                      Hope that helps






                      share|improve this answer













                      It looks like you don't have a From header in your email. A good practice would be to put the following line into your ApplicationMailer:



                      class ApplicationMailer
                      default from: 'noreply@mycustomdomain.com'

                      # ...
                      end


                      To override this in your inheriting mailers, simply declare the same statement. To override it in individual mail methods, put it into the mail call like so:



                      def new_message(user, message)
                      mail(
                      to: user.email,
                      subject: "New message from #message.sender.name",
                      from: message.sender.email
                      )
                      end


                      Hope that helps







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jul 10 '17 at 14:40









                      Clemens KoflerClemens Kofler

                      3391 silver badge8 bronze badges




                      3391 silver badge8 bronze badges












                      • I do have a default from set to the correct address in my mailer. Also the mail is send by Devise as it is a mail to reset a password. It worked for a time without having to override anything so the problem is somewhere else maybe.

                        – Manspider
                        Jul 11 '17 at 7:50











                      • @LRP it's in devise.rb. Need something like this: config.mailer_sender = ENV['SMTP_USERNAME']

                        – Ka Mok
                        Jan 23 '18 at 5:14

















                      • I do have a default from set to the correct address in my mailer. Also the mail is send by Devise as it is a mail to reset a password. It worked for a time without having to override anything so the problem is somewhere else maybe.

                        – Manspider
                        Jul 11 '17 at 7:50











                      • @LRP it's in devise.rb. Need something like this: config.mailer_sender = ENV['SMTP_USERNAME']

                        – Ka Mok
                        Jan 23 '18 at 5:14
















                      I do have a default from set to the correct address in my mailer. Also the mail is send by Devise as it is a mail to reset a password. It worked for a time without having to override anything so the problem is somewhere else maybe.

                      – Manspider
                      Jul 11 '17 at 7:50





                      I do have a default from set to the correct address in my mailer. Also the mail is send by Devise as it is a mail to reset a password. It worked for a time without having to override anything so the problem is somewhere else maybe.

                      – Manspider
                      Jul 11 '17 at 7:50













                      @LRP it's in devise.rb. Need something like this: config.mailer_sender = ENV['SMTP_USERNAME']

                      – Ka Mok
                      Jan 23 '18 at 5:14





                      @LRP it's in devise.rb. Need something like this: config.mailer_sender = ENV['SMTP_USERNAME']

                      – Ka Mok
                      Jan 23 '18 at 5:14











                      2














                      You could try setting :from in your config, using the default_option like this,



                      config.action_mailer.default_options = from: 'noreply@mycustomdomain.com' 





                      share|improve this answer

























                      • this is 10 months old

                        – Manspider
                        May 31 '18 at 6:00















                      2














                      You could try setting :from in your config, using the default_option like this,



                      config.action_mailer.default_options = from: 'noreply@mycustomdomain.com' 





                      share|improve this answer

























                      • this is 10 months old

                        – Manspider
                        May 31 '18 at 6:00













                      2












                      2








                      2







                      You could try setting :from in your config, using the default_option like this,



                      config.action_mailer.default_options = from: 'noreply@mycustomdomain.com' 





                      share|improve this answer















                      You could try setting :from in your config, using the default_option like this,



                      config.action_mailer.default_options = from: 'noreply@mycustomdomain.com' 






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited May 31 '18 at 5:02









                      A J

                      3,02710 gold badges30 silver badges44 bronze badges




                      3,02710 gold badges30 silver badges44 bronze badges










                      answered May 31 '18 at 5:01









                      MonRMonR

                      211 bronze badge




                      211 bronze badge












                      • this is 10 months old

                        – Manspider
                        May 31 '18 at 6:00

















                      • this is 10 months old

                        – Manspider
                        May 31 '18 at 6:00
















                      this is 10 months old

                      – Manspider
                      May 31 '18 at 6:00





                      this is 10 months old

                      – Manspider
                      May 31 '18 at 6:00











                      0














                      I stumbled upon the same problem. My solution was, I edited config/initializers/devise.rb changed a line from config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
                      to config.mailer_sender = ENV["default_from_email"]






                      share|improve this answer



























                        0














                        I stumbled upon the same problem. My solution was, I edited config/initializers/devise.rb changed a line from config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
                        to config.mailer_sender = ENV["default_from_email"]






                        share|improve this answer

























                          0












                          0








                          0







                          I stumbled upon the same problem. My solution was, I edited config/initializers/devise.rb changed a line from config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
                          to config.mailer_sender = ENV["default_from_email"]






                          share|improve this answer













                          I stumbled upon the same problem. My solution was, I edited config/initializers/devise.rb changed a line from config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
                          to config.mailer_sender = ENV["default_from_email"]







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 26 at 17:32









                          gsumkgsumk

                          667 bronze badges




                          667 bronze badges



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45014520%2frails-devise-with-gmail-errors%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                              용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                              155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해