2015-03-03 65 views

回答

1

在它是不可能有规律的方式,因为环境/ *。RB装载在应用程序启动,你不能在运行时改变它。

您可以使用一些邮件gem,它可以在运行时进行配置。

0

是的,你可以。检查http://guides.rubyonrails.org/action_mailer_basics.html#sending-emails-with-dynamic-delivery-options

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