🇺🇸
Hello everyone! Let me share with you a great email template of "Flarum/mentions Post Mentioned Email". This time I shared the description in Chinese and English, the code and the effect of the template is at the bottom of this floor.
- This template comes from the Halo blog system, ❤thanks to the original developer Ryan Wang.
- On the basis of the original template, I improved the adaptation of Flarum and manually translated it into Chinese(中文), English, and Japanese(日本語). You can use it as needed.
⚠**Notice: **
- The mobile email client cannot display the mail style because some mail service providers will remove the declared style tag when you use mobile read the e-mail. Therefore, I used the inline style.
- The declared <style> tags are still retained in the code I posted. This is because I need to write a comment to make it clearer how the style works. You can remove it at deployment time.
📌Tips:
- The default card title background color is the theme color of the forum. You can modify it in the CSS file.
👑 In addition to the Flarum team:
- I found that Flarum's original mechanism is that the activation email for user registration is sent in the user's language. It would be better if such replies and mentioned posts can also be sent in the user's language.
- My current forum has users in three languages, so I have to write all three languages in the current email template. This means that each user receives a single message in a trilingual version. . . Causes an email to show too much content. .
🇨🇳
大家好,我给大家分享一个很好看的邮件模板,代码和效果图在最后面。
- 这个模板来自Halo博客系统,❤感谢[开发者王哥](Ryan Wang)。
- 我在原来的模板基础上,改进了对Flarum的适配,并且人工翻译成了中文、英文、日文三种版本,大家可以按需使用。
⚠注意:
- 由于有些邮件服务商会去除声明的style标签,导致手机邮箱客户端无法展示邮件样式。因此,我使用了内联样式(也就是所有样式都写在body的行内)。
- 我贴出的代码中依然保留了声明的style标签,这是因为我需要写一写注释让大家更清楚地理解样式是怎么起作用的。您可以在部署时自行去掉。
📌Tips:
- 默认卡片标题背景色为论坛的主题色,您可以在CSS文件中自行修改。
👑 另外说给Flarum团队的话:
- 我发现Flarum原本就是用户注册的激活邮件按照用户的语言发送的,如果这种回帖、被提及的的帖子也能按照用户的语言发送就更好了。
- 我现在的论坛是有三种语言的用户,所以我不得已在当前的邮件模板里都把三种语言写进去。这样意味着每一位用户收到的单个邮件都是三语版本的。。。导致一封邮件显示的内容太多了。。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
body {
font-family: 'Open Sans', sans-serif;
background: white;
color: #426799;
margin: 0;
padding: 0;
}
.content {
box-sizing: border-box;
width: 100%;
max-width: 600px;
margin: 0 auto;
padding: 10px 20px;
}
.header-tips {
border-bottom: 1px solid #e8ecf3;
background: #e8ecf3;
}
a {
/* you can change background color to this them default color #3798e8 */
color: {{ $settings->get('theme_primary_color') }};
text-decoration: none;
}
.card-container{
width:100%;
max-width:720px;
text-align:left;
margin:0 auto;
padding-top:20px;
padding-bottom:20px;
}
.card-body{
border-radius:5px;
border:1px solid #eee;
overflow:hidden;
}
h1.card-title{
/* you can change background color to this them default color #3798e8 */
color:#fff;
background:{{ $settings->get('theme_primary_color') }};
line-height:70px;
font-size:24px;
font-weight:normal;
padding-left:40px;
margin:0;
}
.card-postContent{
background:#fff;
padding:20px 32px 40px;
/* ↓ p */
color:#6e6e6e;
font-size:13px;
line-height:24px;
}
.card-replyContent{
color:#6e6e6e;
padding:10px 20px;
background:#f8f8f8;
margin:0;
}
.card-replyContent, .card-replyContent p{
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2; /* p tags only display 2 lines */
overflow: hidden;
max-height: 70px; /* div max height, than hide */
}
.card-footer{
color:#6e6e6e;
text-align:right;
padding:0 32px;
font-size:13px;
line-height:24px;
}
</style>
</head>
</html>
<body style="font-family: 'Open Sans', sans-serif; background: white; color: #426799; margin: 0; padding: 0;">
<div class="header-tips" style="border-bottom: 1px solid #e8ecf3; background: #e8ecf3;">
<div class="content" style="box-sizing: border-box; width: 100%; max-width: 600px; margin: 0 auto; padding: 10px 20px;">
<p>Tips: This email is available in English / 简体中文 / 日本語サポート.</p>
</div>
</div>
<!-- ZH -->
<div class="card-container" style="width:100%; max-width:720px; text-align:left; margin:0 auto; padding-top:20px; padding-bottom:20px;">
<div class="card-body" style="border-radius:5px; border:1px solid #eee; overflow:hidden;">
<h1 class="card-title" style="color:#fff; background:{{ $settings->get('theme_primary_color') }}; line-height:70px; font-size:24px; font-weight:normal; padding-left:40px; margin:0;">
您在 CSUR 社区上的发言有回复啦!
</h1>
<div class="card-postContent" style="background:#fff; padding:20px 32px 40px; color:#6e6e6e; font-size:13px; line-height:24px;">
<p>{!! $user->display_name !!}!, 您好!</p>
<p>您在<a href="{!! app()->url() !!}/d/{!! $blueprint->post->discussion_id !!}/{!! $blueprint->post->number !!}" target="_blank" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">《{!! $blueprint->post->discussion->title !!}》(#{!! $blueprint->post->number !!})楼</a>的发言:
<br>
</p>
<div class="card-replyContent" style="color:#6e6e6e; padding:10px 20px; background:#f8f8f8; margin:0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-height: 70px;">
{!! $blueprint->post->formatContent() !!}
</div>
<p>{!! $blueprint->reply->user->username !!} 回复了您:
<br>
</p>
<div class="card-replyContent" style="color:#6e6e6e; padding:10px 20px; background:#f8f8f8; margin:0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-height: 70px;">
{!! $blueprint->reply->formatContent() !!}
</div>
<p>您可以点击
<a href="{!! app()->url() !!}/d/{!! $blueprint->reply->discussion_id !!}/{!! $blueprint->reply->number !!}" target="_blank" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">查看完整内容</a>
</p>
<p>欢迎再度光临
<a href="{{ $baseUrl }}" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">CSUR 社区</a>
</p>
<p>(此邮件由系统自动发出, 请勿回复。如有打扰,请见谅。)</p>
<p></p>
<p></p>
</div>
<p class="card-footer" style="color:#6e6e6e; text-align:right; padding:0 32px; font-size:13px; line-height:24px;">
邮件发自:<a href="{{ $baseUrl }}" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">CSUR 社区</a>
<br>
主题:<a href="https://github.com/halo-dev/halo" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">Halo</a>
</p>
</div>
</div>
<!-- EN -->
<div class="card-container" style="width:100%; max-width:720px; text-align:left; margin:0 auto; padding-top:20px; padding-bottom:20px;">
<div class="card-body" style="border-radius:5px; border:1px solid #eee; overflow:hidden;">
<h1 class="card-title" style="color:#fff; background:{{ $settings->get('theme_primary_color') }}; line-height:70px; font-size:24px; font-weight:normal; padding-left:40px; margin:0;">
Someone replied to your post!
</h1>
<div class="card-postContent" style="background:#fff; padding:20px 32px 40px; color:#6e6e6e; font-size:13px; line-height:24px;">
<p>
Hey, {!! $user->display_name !!}!
</p>
<p>Your post in<a href="{!! app()->url() !!}/d/{!! $blueprint->post->discussion_id !!}/{!! $blueprint->post->number !!}" target="_blank" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">《{!! $blueprint->post->discussion->title !!}》(#{!! $blueprint->post->number !!})</a>:
<br>
</p>
<div class="card-replyContent" style="color:#6e6e6e; padding:10px 20px; background:#f8f8f8; margin:0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-height: 70px;">
{!! $blueprint->post->formatContent() !!}
</div>
<p>{!! $blueprint->reply->user->username !!} replied to you:
<br>
</p>
<div class="card-replyContent" style="color:#6e6e6e; padding:10px 20px; background:#f8f8f8; margin:0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-height: 70px;">
{!! $blueprint->reply->formatContent() !!}
</div>
<p>You can
<a href="{!! app()->url() !!}/d/{!! $blueprint->reply->discussion_id !!}/{!! $blueprint->reply->number !!}" target="_blank" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">View the Full Reply</a>
</p>
<p>Welcome to
<a href="{{ $baseUrl }}" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">CSUR Community</a> again
</p>
<p>(This message was sent automatically by the system. Please do not reply. Excuse me for any interruptions.)</p>
<p></p>
<p></p>
</div>
<p class="card-footer" style="color:#6e6e6e; text-align:right; padding:0 32px; font-size:13px; line-height:24px;">
Mail from:<a href="{{ $baseUrl }}" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">CSUR Community</a>
<br>
Them form:<a href="https://github.com/halo-dev/halo" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">Halo</a>
</p>
</div>
</div>
<!-- JA -->
<div class="card-container" style="width:100%; max-width:720px; text-align:left; margin:0 auto; padding-top:20px; padding-bottom:20px;">
<div class="card-body" style="border-radius:5px; border:1px solid #eee; overflow:hidden;">
<h1 class="card-title" style="color:#fff; background:{{ $settings->get('theme_primary_color') }}; line-height:70px; font-size:24px; font-weight:normal; padding-left:40px; margin:0;">
CSURコミュニティでの発言に返信があります!
</h1>
<div class="card-postContent" style="background:#fff; padding:20px 32px 40px; color:#6e6e6e; font-size:13px; line-height:24px;">
<p>{!! $user->display_name !!}!, こんにちは!</p>
<p><a href="{!! app()->url() !!}/d/{!! $blueprint->post->discussion_id !!}/{!! $blueprint->post->number !!}" target="_blank" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">《{!! $blueprint->post->discussion->title !!}》(#{!! $blueprint->post->number !!})で</a>の発言:
<br>
</p>
<div class="card-replyContent" style="color:#6e6e6e; padding:10px 20px; background:#f8f8f8; margin:0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-height: 70px;">
{!! $blueprint->post->formatContent() !!}
</div>
<p>{!! $blueprint->reply->user->username !!} はあなたに返信しました:
<br>
</p>
<div class="card-replyContent" style="color:#6e6e6e; padding:10px 20px; background:#f8f8f8; margin:0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-height: 70px;">
{!! $blueprint->reply->formatContent() !!}
</div>
<p>
<a href="{!! app()->url() !!}/d/{!! $blueprint->reply->discussion_id !!}/{!! $blueprint->reply->number !!}" target="_blank" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">をクリックして、完全な内容を見ることもできます。</a>
</p>
<p>またお越しくださいませ
<a href="{{ $baseUrl }}" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">CSURコミュニティ</a>
</p>
<p>(このメールはシステムから自動で送信されますので、返信しないでください。お邪魔しましたら、ご了承ください。)</p>
<p></p>
<p></p>
</div>
<p class="card-footer" style="color:#6e6e6e; text-align:right; padding:0 32px; font-size:13px; line-height:24px;">
メール:<a href="{{ $baseUrl }}" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">CSUR 社区</a>
<br>
ポスト:<a href="https://github.com/halo-dev/halo" style="color: {{ $settings->get('theme_primary_color') }}; text-decoration: none;">Halo</a>
</p>
</div>
</div>
</body>