Permalink
Browse files

Sending emails

  • Loading branch information...
1 parent c1216c2 commit 26b7f6cbfa70d05e872e150752d9a6b0b3c7f404 @pellegrino committed Apr 2, 2012
@@ -4,9 +4,11 @@ module Jackpot
class Notifier < ActionMailer::Base
def send_receipt(payment)
@payment = payment
+ @payment_url = public_receipt_payment_url(:payment_id => @payment.id,
+ :public_token => @payment.public_token)
mail(:to => "#{@payment.customer.email}",
- :from => "ohai@example.com",
+ :from => "dont-reply@example.com",
:subject => "Payment receipt")
end
@@ -1,5 +1,3 @@
-require 'active_support/secure_random'
-
module Jackpot
class Payment < ActiveRecord::Base
before_create :perform_payment
@@ -17,8 +17,9 @@
</tbody>
</table>
<hr>
- <p>
+ <p>
The payment was successfully processed
- </p>
+ </p>
</div>
-You can check your receipt at this URL <%= public_receipt_payment_url(:payment_id => @payment.id, :public_token => @payment.public_token)%>
+
+<p><%= link_to "Check your payment receipt in PDF", @payment_url %></p>
@@ -17,6 +17,16 @@
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.default_url_options = {
+ :host => "example.com",
+ :port => 3000
+ }
+
+ config.default_url_options = {
+ :host => "example.com",
+ :port => 3000
+ }
+ config.action_mailer.delivery_method = :test
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
@@ -8,7 +8,10 @@
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
- config.action_mailer.default_url_options = { :host => "www.example.com" }
+ config.action_mailer.default_url_options = {
+ :host => "example.com",
+ :port => 3000
+ }
# Configure static asset server for tests with Cache-Control for performance
@@ -33,6 +36,17 @@
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
+ config.action_mailer.default_url_options = {
+ :host => "example.com",
+ :port => 3000
+ }
+
+ config.default_url_options = {
+ :host => "example.com",
+ :port => 3000
+ }
+ config.action_mailer.delivery_method = :test
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
@@ -10,7 +10,7 @@
mail.to.should == [payment.customer.email]
end
- it { mail.from.should == ['ohai@example.com'] }
+ it { mail.from.should == ['dont-reply@example.com'] }
it { mail.subject.should == 'Payment receipt' }
it "sends the receipt link at the body" do

0 comments on commit 26b7f6c

Please sign in to comment.