discourse/app/mailers/invite_mailer.rb

22 lines
569 B
Ruby
Raw Normal View History

2013-06-10 15:33:37 -04:00
require_dependency 'email/builder'
2013-02-05 14:16:51 -05:00
class InviteMailer < ActionMailer::Base
2013-04-26 02:56:28 -04:00
default charset: 'UTF-8'
2013-06-10 15:33:37 -04:00
include Email::Builder
2013-02-07 10:45:24 -05:00
2013-02-05 14:16:51 -05:00
def send_invite(invite)
# Find the first topic they were invited to
first_topic = invite.topics.order(:created_at).first
# If they were invited to a topic
build_email invite.email,
'invite_mailer',
invitee_name: invite.invited_by.username,
invite_link: "#{Discourse.base_url}/invites/#{invite.invite_key}",
topic_title: first_topic.try(:title)
end
end