2
votes

In Spree 3.0 "Mail Method Settings" not available by default.

Rails version 4.2.0

Using "gem 'spree_mail_settings', github: 'spree-contrib/spree_mail_settings', branch: '3-0-stable'" in admin panel one link generate in Configuration menu "Mail Method settings".

All configuration done. But when Click on "Test Mail" Button it gives error "An SMTP From address is required to send a message. Set the message smtp_envelope_from, return_path, sender, or from address."

1
I recommend not using spree_mail_settings and configuring your mail using ActionMailer. spree_mail_settings is for older versions of Spree, and was removed from the main code base due to confusion like this. My guess is that spree_mail_settings hasn't been updated for Rails 4.2. You should file an issue on the project if you're intent on using it.gmacdougall

1 Answers

0
votes

I think this answer is a total hack but this is how i got past this issue for my tests. i had to hard code the 'from_address' in order_mailer.confirm_email method to what i would enter anyway in the admin section. here is my code:

  def confirm_email(order, resend = false)
    @order = order.respond_to?(:id) ? order : Spree::Order.find(order)
    subject = (resend ? "[#{Spree.t(:resend).upcase}] " : '')
    subject += "#{Spree::Store.current.name} #{Spree.t('order_mailer.confirm_email.subject')} ##{@order.number}"
    mail(to: @order.email, from: 'yourfromaddress@yourdomain.com', subject: subject)
  end

you would think there should be an easy way to set this value for the test config but i couldn't figure it out.