Skip to content

Commit

Permalink
1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mchung committed Feb 10, 2009
1 parent e7e20b8 commit 26edf58
Show file tree
Hide file tree
Showing 14 changed files with 228 additions and 39 deletions.
6 changes: 6 additions & 0 deletions History.txt
@@ -0,0 +1,6 @@
== 1.1.0 / 2009-02-10
* Converted plugin into a Rubygem with a Rails generator.
* Updated README with installation details.

== 1.0.0 / 2009-02-09
* Tagging original SVN migration.
20 changes: 20 additions & 0 deletions MIT-LICENSE
@@ -0,0 +1,20 @@
Copyright (c) 2009 OpenRain, LLC

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 changes: 0 additions & 20 deletions README

This file was deleted.

82 changes: 82 additions & 0 deletions README.markdown
@@ -0,0 +1,82 @@
ActionMailerTLS
===============

Background
----------

This Ruby on Rails plugin makes it trivial to send email through a Google Apps for business account.

This gem will only work on Ruby 1.8.6.

Installation
------------

If you're on Ruby 1.8.7 and Rails >= 2.2.1, you don't need this plugin. See Notes below.

To install the gem (the preferred way):

1. sudo gem install openrain-action_mailer_tls -s http://gems.github.com
2. ./script/generate action_mailer_tls
3. Copy RAILS_ROOT/config/smtp_gmail.yml.sample to RAILS_ROOT/config/smtp_gmail.yml
4. Update the configuration file with your settings

To (optionally) vendor this gem
1. Add config.gem "openrain-action_mailer_tls", :source => "http://gems.github.com"
2. rake gems:unpack

To install the plugin (the old way)

1. ./script/plugin install git://github.com/openrain/action_mailer_tls.git -r '1.0.0'
2. Copy vendor/plugins/action_mailer_tls/sample/smtp_gmail.rb to config/
3. Copy vendor/plugins/action_mailer_tls/sample/mailer.yml.sample to config/
4. Update the configuration file with your settings

Testing it out
--------------

1. ./script/generate mailer Notifier hello_world
2. Add the following lines to config/environments/development.rb
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
3. Update the recipients and from fields in app/models/notifier.rb
4. ./script/console
5. >> Notifier.deliver_hello_world!
Resources
---------

Blog posts

* http://www.rubyinside.com/how-to-use-gmails-smtp-server-with-rails-394.html
* http://www.prestonlee.com/archives/63

Books

* Advanced Rails Recipes pg. 238, Recipe #47.

Notes
-----

If you're running Rails >= 2.2.1 [RC2] and Ruby 1.8.7, you don't need this plugin. Ruby 1.8.7 supports
SMTP TLS and Rails 2.2.1 ships with an option to enable it if you're running Ruby 1.8.7.

To set it all up, in config/initializers/smtp_gmail.rb:
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true
:user_name: your_username@gmail.com
:password: h@ckme
}

http://github.com/rails/rails/commit/732c724df61bc8b780dc42817625b25a321908e4

Author
------
* Marc Chung - marc [dot] chung [at] openrain [dot] com

License
-------
* Copyright (c) 2009 OpenRain, LLC. See MIT-LICENSE for details
43 changes: 43 additions & 0 deletions Rakefile
@@ -0,0 +1,43 @@
begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "action_mailer_tls"
s.summary = "Send Email via Gmail"
s.email = "marc.chung@openrain.com"
s.homepage = "http://github.com/openrain/action_mailer_tls"
s.description = "Conveniently send emails through Google's Hosted App service"
s.authors = ["Marc Chung"]
s.files = FileList["[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"]
end
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end

require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'action_mailer_tls'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end

# require 'rake/testtask'
# Rake::TestTask.new(:test) do |t|
# t.libs << 'lib' << 'test'
# t.pattern = 'test/**/*_test.rb'
# t.verbose = false
# end
#
# begin
# require 'rcov/rcovtask'
# Rcov::RcovTask.new do |t|
# t.libs << 'test'
# t.test_files = FileList['test/**/*_test.rb']
# t.verbose = true
# end
# rescue LoadError
# puts "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
# end

task :default => :test
4 changes: 4 additions & 0 deletions VERSION.yml
@@ -0,0 +1,4 @@
---
:patch: 0
:major: 1
:minor: 1
29 changes: 29 additions & 0 deletions action_mailer_tls.gemspec
@@ -0,0 +1,29 @@
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{action_mailer_tls}
s.version = "1.1.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Marc Chung"]
s.date = %q{2009-02-10}
s.description = %q{Conveniently send emails through Google's Hosted App service}
s.email = %q{marc.chung@openrain.com}
s.files = ["History.txt", "README.markdown", "VERSION.yml", "generators/USAGE", "generators/action_mailer_tls_generator.rb", "generators/templates", "generators/templates/config", "generators/templates/config/initializers", "generators/templates/config/initializers/smtp_gmail.rb", "generators/templates/config/smtp_gmail.yml.sample", "lib/smtp_tls.rb"]
s.has_rdoc = true
s.homepage = %q{http://github.com/openrain/action_mailer_tls}
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.1}
s.summary = %q{Send Email via Gmail}

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
else
end
else
end
end
16 changes: 16 additions & 0 deletions generators/USAGE
@@ -0,0 +1,16 @@
Description:
The action_mailer_tls generator adds smtp-tls support to your Rails projects.

The generator takes no arguments and only needs to be run once. It will create
a Rails initializer for Gmail, and a sample YAML configuration file.

Modify the contents of the configuration file with your Gmail username and
password

Example:
./script/generate action_mailer_tls

This will create the following files:
Initializer: config/initializers/smtp_gmail.rb
Config: config/smtp_gmail.yml.sample

11 changes: 11 additions & 0 deletions generators/action_mailer_tls_generator.rb
@@ -0,0 +1,11 @@
# This generator intalls ActionMailerTLS into a Rails project
class ActionMailerTlsGenerator < Rails::Generator::Base

def manifest
record do |m|
m.file "config/smtp_gmail.yml.sample", "config/smtp_gmail.yml.sample"
m.file "config/initializers/smtp_gmail.rb", "config/initializers/smtp_gmail.rb"
end
end

end
14 changes: 14 additions & 0 deletions generators/templates/config/initializers/smtp_gmail.rb
@@ -0,0 +1,14 @@
# This file is automatically copied into RAILS_ROOT/initializers

require "smtp_tls"

config_file = "#{RAILS_ROOT}/config/smtp_gmail.yml"
raise "Sorry, you must have #{config_file}" unless File.exists?(config_file)

config_options = YAML.load_file(config_file)
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true
}.merge(config_options) # Configuration options override default options
3 changes: 3 additions & 0 deletions generators/templates/config/smtp_gmail.yml.sample
@@ -0,0 +1,3 @@
---
:user_name: your_username@gmail.com
:password: h@ckme
1 change: 0 additions & 1 deletion init.rb

This file was deleted.

6 changes: 0 additions & 6 deletions sample/mailer.yml.sample

This file was deleted.

12 changes: 0 additions & 12 deletions sample/smtp_gmail.rb

This file was deleted.

0 comments on commit 26edf58

Please sign in to comment.