Skip to content

Instantly share code, notes, and snippets.

@jonpaul
Created June 27, 2011 16:43
Show Gist options
  • Save jonpaul/1049248 to your computer and use it in GitHub Desktop.
Save jonpaul/1049248 to your computer and use it in GitHub Desktop.
class UserMailer < ActionMailer::Base
default :from => "[email protected]"
def reset_password_email(user)
@user = user
@reset_password_link = edit_password_reset_url(user.perishable_token)
mail(
:to => user.email,
:from => "[email protected]",
:subject => 'Reset password instructions'
)
end
def purchase_confirmation_email(user, order)
@user = user
@order = order
mail(
:to => user.email,
:bcc => "[email protected]",
:from => "[email protected]",
:subject => 'Purchase Confirmation'
)
end
def investor_fail_notification(user, coupon)
@sender = user
@coupon = coupon
mail(
:to => @sender.email,
:from => "[email protected]",
:subject => "Thank you! Sorry, but your investor inquery was not approved."
)
end
def investor_approve_notification(user)
@sender = user
mail(
:to => @sender.email,
:from => "[email protected]",
:subject => "Thank you! Your investor inquery has been approved!"
)
end
def contact_vehicle_listing_email(listing, params)
@listing = listing
@message = params[:message]
@name = params[:name]
@best_time = params[:time_for_contact]
@phone = params[:phone]
if @listing.dealer_id.blank?
@email = listing.contact_email
else
@email = listing.dealer.email
end
mail(
:to => @email,
:from => params[:email],
:subject => "Interested in #{listing.year} #{listing.vehicle_make.name} #{listing.vehicle_model.name}"
)
end
def insure_notification(insure)
@sender = insure
mail(
:to => "[email protected]",
:from => @sender.email,
:subject => "New Insurance Quote Request"
)
end
def dealer_apply_notification(user, dealer)
@sender = user
@dealer = dealer
mail(
:to => "[email protected]",
:from => @sender.email,
:subject => "A New Dealer has Submitted Information for Review."
)
end
def notemember_apply_notification(user, notemember, investor_type)
@type = investor_type
@sender = user
@notemember = notemember
mail(
:to => "[email protected]",
:from => @sender.email,
:subject => "A New Lein Investor has Submitted Information for Review."
)
end
def contact_notification(sender)
@sender = sender
mail(
:to => "[email protected]",
:from => @sender.email,
:subject => "New Contact request from #{@sender.name}"
)
end
def finance_notification(sender)
@sender = sender
mail(
:to => "[email protected]",
:from => @sender.email,
:subject => "New Finance request"
)
end
def advert_active_notification(recipt)
@recipient = recipt
mail(
:to => @recipient.email,
:from => "[email protected]",
:subject => "Your approved advertisement is now active on InvestYourCar.com"
)
end
def advert_payment_request(recipt, advert)
@recipient = recipt
@advertid = advert
mail(
:to => @recipient.email,
:from => "[email protected]",
:subject => "Your approved advertisement is now pending payment on InvestYourCar.com"
)
end
def notemember_note_email(user, notes)
@user = user
@notemember = Hashie::Mash.new(user.note_users)
@notes = notes
mail(
:to => "[email protected]",
:from => @user.email,
:subject => "#{@user.first_name} #{@user.last_name} is interested in the following notes"
)
end
def advertisement_pending_approval(advertisement)
@advertisement = advertisement
mail(
:to => "[email protected]",
:from => "[email protected]",
:subject => "A new advertisement is pending your approval"
)
end
def new_user_welcome(user)
@user = user
mail(
:to => @user.email,
:from => '[email protected]',
:subject => 'Welcome to InvestYourCar.com'
)
end
def dealerimport_notification(contact, user)
@contact = contact
@user = user
if @contact.(params[:provider]) == 'CarForSale.com'
mail(
:to => '[email protected]',
:from => @user.email,
:subject => 'A New Listings Import Request has been made for CarForSale.'
)
elsif @contact.(params[:provider]) == 'CarThink.com'
mail(
:to => '[email protected]',
:from => @user.email,
:subject => 'A New Listings Import Request has been made for CarThink.'
)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment