Help: Script isn't sending any email


#1

Hi,
I followed the directions to a ‘T’ from the following website:

http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer

However, the script is dying because it says that the <%= first_name %>
value in my notifier view is nil.

here is my code:

Controller code (abridged):

def signup
userid = @session[:user].id
@user = User.find(userid)
@bill = Billing.find(userid)
@transaction = MyTransaction.new

…save some stuff to both billing and transaction …

if ((@bill.save) && (@transaction.save))
Notifier::deliver_transaction_receipt_email(@user, @bill, @transaction)
end
end

Notifier model code:

def transaction_receipt_email( user, bill, transaction )

Email header info MUST be added here

@recipients = user.email
@from = “removed_email_address@domain.invalid”
@subject = “Thank you for your payment”

Email body substitutions go here

@body[“first_name”] = user.first_name
@body[“last_name”] = user.last_name
@body[“transaction_id”] = transaction.id
@body[“amount”] = transaction.amount
@body[“account_balance”] = bill.current_account_balance
end

View Code:

Dear <%= @first_name %> <%= @last_name %>,

We have successfully received your payment of $<%= @amount %>. Your new account balance is:
$<%= @current_account_balance %>

Transaction id: <%= transaction)id %>

Please save this email receipt for your records.