class UserMailer < ActionMailer::Base include Roadie::Rails::Automatic default from: "mission_control@avalanche.network" def signup_message(user) I18n.with_locale(user.language) do config = Info.first mail :to => user.email, :subject => (t 'sign_up_email.email_subject'), :from => 'mission_control@avalanche.network', :from_name => 'Avalanche Network' end end def contact_message(contact_message, to_address) @msg = contact_message mail :to => to_address, :subject => @msg.title, :from => @msg.user == nil ? @msg.email : @msg.user.email, :from_name => @msg.user != nil ? @msg.user.full_name : @msg.email, :body => @msg.content end def newsletter_subscription(subscription) config = Info.first mail :to => subscription.email, :subject => (t 'newsletter_subscription.subject'), :from => config.contact_email, :from_name => config.website_name, :body => (t 'newsletter_subscription.message') end def invite_message(user, from, content) @user = user @token = user.raw_invitation_token invitation_link = accept_user_invitation_url(:invitation_token => @token) I18n.with_locale(from.language) do mail(:from => from, :bcc => from, :to => @user.email, :subject => (t 'invite_message.email_subject')) do |format| content = content.gsub('{{invitation_link}}', invitation_link) format.text do render :text => content end format.html do render :html => content end end end end end