actionmailer_multiple_smtp
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Gives ActionMailer ability to use different SMTP accounts based on a message's from address.
= actionmailer_multiple_smtp

Gives ActionMailer ability to use different SMTP accounts based on a message's from address.


== Install

  sudo gem sources -a http://gems.github.com
  sudo gem install jwulff-actionmailer_multiple_smtp


== Usage

In your environments (config/environments/*.rb) add something like this to make mail from 'special_sender@domain.com' use the :username => 'special_sender' SMTP settings and all other mail use the :username => 'mailer' SMTP settings.

  ActionMailer::Base.delivery_method = :smtp
  ActionMailer::Base.smtp_settings = {
    :address   => 'smtp.domain.com',
    :domain    => 'domain.com',
    :username  => 'mailer',
    :password  => '******'
  }
  config.after_initialize do
    ActionMailer::Base.smtp_settings_by_from_address['special_sender@domain.com'] = {
      :address   => 'smtp.domain.com',
      :domain    => 'domain.com',
      :username  => 'special_sender',
      :password  => '******'
    }
  end
  
If you're using GMail for SMTP, install the tlsmail gem and add something like this to your environments:
  
  Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
  ActionMailer::Base.delivery_method = :smtp
  ActionMailer::Base.smtp_settings = {
    :address        => 'smtp.gmail.com',
    :port           => 587,
    :domain         => 'domain.com',
    :user_name      => 'user@domain.com',
    :password       => '******',
    :authentication => :plain
  }
  config.after_initialize do
    ActionMailer::Base.smtp_settings_by_from_address['special_sender@domain.com'] = {
      :address        => 'smtp.gmail.com',
      :port           => 587,
      :domain         => 'domain.com',
      :user_name      => 'special_sender@domain.com',
      :password       => '******',
      :authentication => :plain
    }
  end

== Copyright

Copyright (c) 2009 John Wulff. See LICENSE for details.

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。