diff --git a/app/controllers/accounts/invitations_controller.rb b/app/controllers/accounts/invitations_controller.rb index 112a842..2cc716d 100644 --- a/app/controllers/accounts/invitations_controller.rb +++ b/app/controllers/accounts/invitations_controller.rb @@ -11,7 +11,7 @@ def new def create @invitation = current_account.account_invitations.new(invitation_params) if @invitation.save - # AccountMailer.invitation_email(@invitation).deliver_later + AccountMailer.invitation_email(@invitation).deliver_later redirect_to invitations_path(account_id: current_account), notice: t(".invitation_sent", email: @invitation.email) else render :new, status: :unprocessable_entity diff --git a/app/mailers/account_mailer.rb b/app/mailers/account_mailer.rb new file mode 100644 index 0000000..4b79d02 --- /dev/null +++ b/app/mailers/account_mailer.rb @@ -0,0 +1,7 @@ +class AccountMailer < ApplicationMailer + def invitation_email(invitation) + @invitation = invitation + @account = invitation.account + mail to: invitation.email, subject: t(".subject", team_name: @account.name) + end +end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 3c34c81..9a23378 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,4 +1,4 @@ class ApplicationMailer < ActionMailer::Base - default from: "from@example.com" + default from: Kiqr::Config.default_from_email layout "mailer" end diff --git a/app/views/account_mailer/invitation_email.text.erb b/app/views/account_mailer/invitation_email.text.erb new file mode 100644 index 0000000..95c1a0a --- /dev/null +++ b/app/views/account_mailer/invitation_email.text.erb @@ -0,0 +1,8 @@ +<%= t(".welcome", app_name: Kiqr::Config.app_name) %> +======================================= + +<%= t(".instructions", team_name: @account.name, app_name: Kiqr::Config.app_name) %> + +<%= user_invitation_url(@invitation) %> + +<%= t(".thanks") %> diff --git a/app/views/layouts/kiqr/mailer.html.erb b/app/views/layouts/kiqr/mailer.html.erb new file mode 100644 index 0000000..3aac900 --- /dev/null +++ b/app/views/layouts/kiqr/mailer.html.erb @@ -0,0 +1,13 @@ + + +
+ + + + + + <%= yield %> + + diff --git a/app/views/layouts/kiqr/mailer.text.erb b/app/views/layouts/kiqr/mailer.text.erb new file mode 100644 index 0000000..37f0bdd --- /dev/null +++ b/app/views/layouts/kiqr/mailer.text.erb @@ -0,0 +1 @@ +<%= yield %> diff --git a/app/views/users/invitations/show.html.erb b/app/views/users/invitations/show.html.erb index 8eae6fb..598b7f1 100644 --- a/app/views/users/invitations/show.html.erb +++ b/app/views/users/invitations/show.html.erb @@ -21,7 +21,7 @@<%= t(".guest_instructions", team_name: @team.name) %>