用于创建和包装邮件发送行为的辅助方法,由 DeliveryMethods 使用。
方法
实例公共方法
add_delivery_method(symbol, klass, default_options = {}) 链接
使用给定的符号作为别名,并通过给定的类添加新的邮件发送方法,以及指定的默认选项。
add_delivery_method :sendmail, Mail::Sendmail, location: '/usr/sbin/sendmail', arguments: %w[ -i ]
来源: 显示 | 在 GitHub 上
# File actionmailer/lib/action_mailer/delivery_methods.rb, line 51 def add_delivery_method(symbol, klass, default_options = {}) class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings") public_send(:"#{symbol}_settings=", default_options) self.delivery_methods = delivery_methods.merge(symbol.to_sym => klass).freeze end