emails: update email templates.
* Add header with the Danbooru name and logo. * Add footer with links to the site, the privacy policy, and the contact page. * Add "You received this email because of X" messages to remind users why they received the email. * Add basic CSS to make the design match the site.
This commit is contained in:
@@ -4,7 +4,8 @@ class UserMailer < ApplicationMailer
|
||||
# The email sent when a user receives a DMail.
|
||||
def dmail_notice(dmail)
|
||||
@dmail = dmail
|
||||
mail(dmail.to, require_verified_email: true, subject: "#{Danbooru.config.app_name} - Message received from #{dmail.from.name}")
|
||||
@user = dmail.to
|
||||
mail(@user, require_verified_email: true, subject: "#{Danbooru.config.app_name}: #{dmail.from.name} sent you a message")
|
||||
end
|
||||
|
||||
# The email sent when a user requests a password reset.
|
||||
|
||||
55
app/views/layouts/user_mailer.html.erb
Normal file
55
app/views/layouts/user_mailer.html.erb
Normal file
@@ -0,0 +1,55 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: "Tahoma", "Verdana", "Helvetica", sans-serif;
|
||||
font-size: 16px;
|
||||
padding: 0 1em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0075f8;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #8caaff;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin-left: 0;
|
||||
padding-left: 0.5em;
|
||||
opacity: 0.75;
|
||||
border-left: 3px solid #d1d1da;
|
||||
}
|
||||
|
||||
.fineprint {
|
||||
color: #9192a7;
|
||||
font-size: 12px;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="max-width: 960px; margin: 0 auto;">
|
||||
<h1 style="text-align: center">
|
||||
<%= link_to image_tag(image_url("/images/danbooru-logo-96x96.png", host: root_url), width: 36, height: 36, style: "vertical-align: middle"), root_url %>
|
||||
<%= link_to Danbooru.config.canonical_app_name, root_url %>
|
||||
</h1>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
<div style="text-align: center">
|
||||
<hr>
|
||||
<p style="font-size: 12px">
|
||||
<%= link_to image_tag(image_url("/images/danbooru-logo-96x96.png", host: root_url), width: 16, height: 16, style: "vertical-align: middle"), root_url %>
|
||||
<%= link_to Danbooru.config.canonical_app_name, root_url %> /
|
||||
<%= link_to "Privacy", privacy_policy_url %> /
|
||||
<%= link_to "Contact", contact_url %>
|
||||
<% if content_for(:footer_links).present? %>
|
||||
<%= yield :footer_links %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,12 +1,21 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<p><%= @dmail.from.name %> said:</p>
|
||||
<p>Hi <%= link_to_user @user %>,</p>
|
||||
|
||||
<p><%= link_to_user @dmail.from %> sent you a message on <%= link_to Danbooru.config.canonical_app_name, root_url %>:</p>
|
||||
|
||||
<div class="prose" style="margin: 0 2em">
|
||||
<b><%= @dmail.title %></b>
|
||||
|
||||
<div class="prose">
|
||||
<%= format_text(@dmail.body, base_url: root_url) %>
|
||||
</div>
|
||||
|
||||
<p><%= link_to "View message", dmail_url(@dmail) %> | <%= link_to "Disable notifications", disable_email_notifications_url(@dmail.to) %></p>
|
||||
</body>
|
||||
</html>
|
||||
<%= link_to "Reply", new_dmail_url(respond_to_id: @dmail) %> |
|
||||
<%= link_to "View message", dmail_url(@dmail) %>
|
||||
|
||||
<p class="fineprint">
|
||||
You received this email because you chose to receive notifications whenever someone sends you a message on <%= Danbooru.config.canonical_app_name %>.
|
||||
<%= link_to "Click here", disable_email_notifications_url(@user) %> to unsubscribe from these emails.
|
||||
</p>
|
||||
|
||||
<% content_for(:footer_links) do %>
|
||||
/ <%= link_to "Unsubscribe", disable_email_notifications_url(@user) %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<h2>Hi <%= @user.name %>,</h2>
|
||||
<h2>Hi <%= link_to_user @user %>,</h2>
|
||||
|
||||
<p>
|
||||
You recently changed your email address on <%= Danbooru.config.app_name %>.
|
||||
Click the link below to verify your new email address.
|
||||
</p>
|
||||
<p>
|
||||
You changed your email address on <%= link_to Danbooru.config.canonical_app_name, root_url %>.
|
||||
Click the link below to verify your new email address:
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= link_to "Verify email address", email_verification_url(@user) %>
|
||||
</p>
|
||||
<p style="margin-left: 2em">
|
||||
<%= link_to "Verify email address", email_verification_url(@user) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you did not recently change your email address on <%= Danbooru.config.app_name %>,
|
||||
you may delete and ignore this email.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
<p class="fineprint">
|
||||
You received this email because someone changed their email to this address on <%= link_to Danbooru.config.canonical_app_name, root_url %>. If this
|
||||
wasn't you, you may ignore this email.
|
||||
</p>
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<p>
|
||||
You recently requested your <%= Danbooru.config.app_name %> password to be reset.
|
||||
Click the link below to login to <%= Danbooru.config.app_name %> and reset your password.
|
||||
</p>
|
||||
<h2>Hi <%= link_to_user @user %>,</h2>
|
||||
|
||||
<p>
|
||||
<%= link_to "Reset password", edit_user_password_url(@user, signed_user_id: Danbooru::MessageVerifier.new(:login).generate(@user.id, expires_in: 30.minutes)) %>
|
||||
</p>
|
||||
<p>
|
||||
You requested your <%= link_to Danbooru.config.canonical_app_name, root_url %> password to be reset.
|
||||
Click the link below to reset your password:
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you did not request for your <%= Danbooru.config.app_name %> password to
|
||||
be reset, please ignore this email or reply to let us know. This link
|
||||
will only be valid for the next 30 minutes.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
<p style="margin-left: 2em">
|
||||
<%= link_to "Reset password", edit_user_password_url(@user, signed_user_id: Danbooru::MessageVerifier.new(:login).generate(@user.id, expires_in: 30.minutes)) %>
|
||||
</p>
|
||||
|
||||
<p class="fineprint">
|
||||
You received this email because someone requested a password reset for your account on <%= link_to Danbooru.config.canonical_app_name, root_url %>.<br>
|
||||
If this wasn't you, you may ignore this email. This link will expire in 30 minutes.
|
||||
</p>
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<h2>Hi <%= @user.name %>,</h2>
|
||||
<h2>Hi <%= link_to_user @user %>,</h2>
|
||||
|
||||
<p>
|
||||
Welcome to <%= Danbooru.config.app_name %>! Click the link below to verify your email address.
|
||||
</p>
|
||||
<p>
|
||||
Welcome to <%= link_to Danbooru.config.canonical_app_name, root_url %>! Click the link below to verify your email address:
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= link_to "Verify email address", email_verification_url(@user) %>
|
||||
</p>
|
||||
<p style="margin-left: 2em">
|
||||
<%= link_to "Verify email address", email_verification_url(@user) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
By verifying your email address, you can receive site notifications and you can
|
||||
recover your account if you ever forget your password.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
<p class="fineprint">
|
||||
You received this email because someone signed up for <%= link_to Danbooru.config.canonical_app_name, root_url %> with your address.
|
||||
<%= link_to "Click here", disable_email_notifications_url(@user) %> to disable email notifications.
|
||||
</p>
|
||||
|
||||
<% content_for(:footer_links) do %>
|
||||
/ <%= link_to "Unsubscribe", disable_email_notifications_url(@user) %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user