spree-contrib/spree_mail_settings

Compatibility with Spree 4.1

Opened this issue ยท 11 comments

Need some help here ๐Ÿ˜•

Getting the error below when trying this gem out with spree 4.1, I've tried removing the dependencies but giving me a "NoMethodError in Spree::Admin::MailMethods#edit" for enable_mail_delivery preference not defined

Bundler could not find compatible versions for gem "spree_auth_devise":
In snapshot (Gemfile.lock):
spree_auth_devise (= 4.1.0)

In Gemfile:
spree_auth_devise (~> 4.1)

spree_mail_settings was resolved to 3.3.0, which depends on
  spree_auth_devise (< 4.0, >= 3.1.0)

I have the same issue. Added spree_mail_settings to Gemfile:

gem 'spree_mail_settings', github: 'spree-contrib/spree_mail_settings'

bundle update

Bundler could not find compatible versions for gem "spree_auth_devise":
In Gemfile:
spree_auth_devise (~> 4.1)

spree_mail_settings was resolved to 3.3.0, which depends on
  spree_auth_devise (>= 3.1.0, < 4.0)

Same issue but with Spree 4.0.

Bundler could not find compatible versions for gem "spree_auth_devise":

  In snapshot (Gemfile.lock):
    spree_auth_devise (= 4.1.0)

  In Gemfile:
    spree_auth_devise (~> 4.0)

    spree_mail_settings was resolved to 3.3.0, which depends on
      spree_auth_devise (>= 3.1.0, < 4.0)

Hi
I also experienced the same issue with Spree 4.1.
I found out the reason is because the spree_mail_settings has been restricted to versions between '3.1' and '4.0'.
You can find this info under the gemspec file at the root: spree_mail_settings.gemspec
Check line 25: spree_version = '>= 3.1.0', '< 4.0'

To test, i forked the spree_mail_settings, pointed the gem version in gemfile to the one i have forked in github. Then i changed the gemspec file to spree_version = '>= 3.1.0', '<= 4.1' and the bundle update worked.
But i now have an issue with the decorator for preferences not being found, so when i open the link to the Mail Settings under admin, it throws an error NoMethodError in Spree::Admin::MailMethods#edit

Why are the decorators not being found ? Any way around it

The case for decorators not being loaded and hence preferences defined under app/model/spree/app_configuration_decorator.rb not being found error....

a small work around as we wait for an updated spree_mail_settings gem, under the fork you created, you can add an initializer folder and add the preferences configuration file there with the preferences specified under models/spree/app_configuration_decorator.rb. This will ensure the added spree_mail_settings preferences are loaded

The case for decorators not being loaded and hence preferences defined under app/model/spree/app_configuration_decorator.rb not being found error....

a small work around as we wait for an updated spree_mail_settings gem, under the fork you created, you can add an initializer folder and add the preferences configuration file there with the preferences specified under models/spree/app_configuration_decorator.rb. This will ensure the added spree_mail_settings preferences are loaded

Thanks, worked like a charm โœŒ๏ธ

Still getting the same error referenced at the start of this issue. Fixed by using the link above and cloning the gem file into my vendor folder. Edited the line

#spree_mail_settings.gemspec
spree_version = '>= 3.1.0', '<= 4.2'
# gemfile.rb
gem 'spree_mail_settings', :path => 'vendor/spree_mail_settings'

Ran bundle, restarted server and no issues

kykyi commented

@leonmuchoki and @weefunker do you guys have recommendations on how to successfully push this to heroku? The views load in development, but no emails received, then when I attempt to push to production I get

remote: -----> Installing dependencies using bundler 2.0.2
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4
remote:        The path `/tmp/build_e65e8575/vendor/spree_mail_settings` does not exist.
remote:        Bundler Output: The path `/tmp/build_e65e8575/vendor/spree_mail_settings` does not exist.

Thanks in advance guys

@bashford7 I ended up just using typical rails app mail settings instead. This plugin is completely unnecessary unless you need to allow some nontechie to change the SMTP settings from the dashboard.

#production.rb 
 config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
      :address              => 'smtp.gmail.com',
      :port                 => 587,
      :domain               => 'gmail.com',
      :user_name            => 'EMAIL_ADDRESS@gmail.com',
      :password             => 'pass',
      :authentication       => 'login',
      :enable_starttls_auto => true
  }

kykyi commented

Thanks @weefunker works a treat now! Adapted your answer to work on SendGrid:

config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  host = 'voyage-fromage-60583.herokuapp.com'
  config.action_mailer.default_url_options = { host: host }
  ActionMailer::Base.smtp_settings = {
   :address        => 'smtp.sendgrid.net',
   :port           => '587',
   :authentication => :plain,
   :user_name      => ENV['SENDGRID_USERNAME'],
   :password       => ENV['SENDGRID_PASSWORD'],
   :domain         => 'heroku.com',
   :enable_starttls_auto => true
  }

@bashford7 I ended up just using typical rails app mail settings instead. This plugin is completely unnecessary unless you need to allow some nontechie to change the SMTP settings from the dashboard.

#production.rb 
 config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
      :address              => 'smtp.gmail.com',
      :port                 => 587,
      :domain               => 'gmail.com',
      :user_name            => 'EMAIL_ADDRESS@gmail.com',
      :password             => 'pass',
      :authentication       => 'login',
      :enable_starttls_auto => true
  }

Thanks I was wondering if this was necessary