spree icon indicating copy to clipboard operation
spree copied to clipboard

How to config smtp for different Spree store

Open chuckaiyu opened this issue 1 year ago • 3 comments

Two store use different domain and smtp server. How to config it?

chuckaiyu avatar Jul 21 '24 07:07 chuckaiyu

Save smtp setting in store config, use Rails ActionMailer method option delivery_method_options.

class UserMailer < ApplicationMailer
  def welcome_email
    @user = params[:user]
    @url  = user_url(@user)
    delivery_options = { user_name: params[:company].smtp_user,
                         password: params[:company].smtp_password,
                         address: params[:company].smtp_host }
    mail(to: @user.email,
         subject: "Please see the Terms and Conditions attached",
         delivery_method_options: delivery_options)
  end
end

chuckaiyu avatar Jul 21 '24 07:07 chuckaiyu

hey @chuckaiyu , I have tried to upgrade spree mail setting gem and made it store specific SMTP configuration setting.

Hope this will helpful for you, Check this: https://github.com/rahul2103/spree_mail_settings

Thanks.

rahul2103 avatar Jul 26 '24 08:07 rahul2103

@rahul2103 Wow, Thanks!

chuckaiyu avatar Jul 29 '24 06:07 chuckaiyu