Created
February 29, 2012 21:40
-
-
Save acwright/1944639 to your computer and use it in GitHub Desktop.
Revisions
-
acwright revised this gist
Feb 29, 2012 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ require 'sinatra' require 'action_mailer' class Mailer < ActionMailer::Base -
acwright revised this gist
Feb 29, 2012 . 1 changed file with 21 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,29 +13,29 @@ def contact end configure do set :root, File.dirname(__FILE__) set :views, File.join(Sinatra::Application.root, 'views') set :haml, { :format => :html5 } if production? ActionMailer::Base.smtp_settings = { :address => "smtp.sendgrid.net", :port => '25', :authentication => :plain, :user_name => ENV['SENDGRID_USERNAME'], :password => ENV['SENDGRID_PASSWORD'], :domain => ENV['SENDGRID_DOMAIN'], } ActionMailer::Base.view_paths = File.join(Sinatra::Application.root, 'views') else ActionMailer::Base.delivery_method = :file ActionMailer::Base.file_settings = { :location => File.join(Sinatra::Application.root, 'tmp/emails') } ActionMailer::Base.view_paths = File.join(Sinatra::Application.root, 'views') end end post '/mail' do email = Mailer.contact email.deliver end -
acwright created this gist
Feb 29, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ require 'action_mailer' class Mailer < ActionMailer::Base def contact mail( :to => "[email protected]", :from => "[email protected]", :subject => "Test") do |format| format.text format.html end end end configure do set :root, File.dirname(__FILE__) set :views, File.join(Sinatra::Application.root, 'views') set :haml, { :format => :html5 } if production? ActionMailer::Base.smtp_settings = { :address => "smtp.sendgrid.net", :port => '25', :authentication => :plain, :user_name => ENV['SENDGRID_USERNAME'], :password => ENV['SENDGRID_PASSWORD'], :domain => ENV['SENDGRID_DOMAIN'], } ActionMailer::Base.view_paths = File.join(Sinatra::Application.root, 'views') else ActionMailer::Base.delivery_method = :file ActionMailer::Base.file_settings = { :location => File.join(Sinatra::Application.root, 'tmp/emails') } ActionMailer::Base.view_paths = File.join(Sinatra::Application.root, 'views') end end post '/mail' do email = Mailer.contact email.deliver end