-
-
Notifications
You must be signed in to change notification settings - Fork 835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: notification unsubscribe & email overhaul with HTML multipart #3872
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this a lot, great job! My only thought: maybe we should have the unsubscribe controller redirect to the settings page, with a payload in the URL that would trigger an alert / popup / etc?
I did consider that at one point, however that would also require the user to be either logged in, or be bounced thru an auth flow before bing able to present their settings. My understanding for |
That's a good point. I think "unsubscribe on click + link to settings page" is a good compromise. Instead of unsubscribing on the GET request, maybe that page should be a form (autosubmitted via JS), that pings a POST endpoint? |
And if JS is disabled/not available in the email client webview/whatever? |
Then show a button. Most unsubscribe links I've experience ask you to click a button to confirm; the annoying ones are where you need to click a bunch of checkboxes. What I'm proposing is pretty much what's discussed in the comment thread started by @luceos |
Yeah, sorry I was having a "moment" 🙈 I'm already working on this, should be ready shortly |
…r.php Co-authored-by: Sami Mazouz <[email protected]>
Removals, changes & additions
SendRawEmailJob
is removed, and replaced withSendInformationalEmailJob
.Usage example:
Outgoing email format
By setting the
mail_format
totext
, you're instructing Flarum to only send emails in the plain text format, disregarding the HTML version and multipart option. Adjust this setting according to your needs, but it is recommended to leave it at it's default.Notification templates
Flarum now has two types of notifications/emails.
Notification
andInformational
. Informational emails are things like, password confirm, test, etc. Basically an email that does not require (or should not have) an unsubscribe link and are classified as "essential" or "service" mail.For all other emails, this should probably fall into the
Notification
type. These notifications automatically generate an unsubscribe link and this is rendered in the footer of the email (both HTML and plain).For this reason, when constructing
blade
templates for emails, you should extend one of the base types:HTML
@extends('flarum.forum::email.html.notification.base')
@extends('flarum.forum::email.html.information.base')
When rendering content and/or preview content in a HTML template, it must be wrapped in the utility
$formatter->convert($yourContent)
For example:or, for a
Post
object:{!! $blueprint->formatContent() !!}
Plain
@extends('flarum.forum::email.plain.notification.base')
@extends('flarum.forum::email.plain.information.base')
Both templates allow for sectioned data to be rendered. It is no longer required to include the user greeting, this is now contained in a translation key
core.email.greeting
, for example "Hey username".contentPreview
is optional, if your blade template does not provide it, nothing will be rendered in it's template area.content
is always required.Emails now also have a "signoff" section. Here, the translation key
core.email.signoff
by default will render "The {YOUR_FORUM_NAME} team".Should you wish to disable either the greeting or signoff, this can be done on a template by template method:
@extends('flarum.forum::email.html.notification.base', ['greeting' => false, 'signoff' => false])
UnsubsribeToken
MailableInterface
so that notification blueprints return bothplain
andhtml
viewsplain
andhtml
for all notification emails to extend.multipart
,plain
orhtml
emails from the forumraw
emails (email test, forgot password, etc)Screenshots
Example
informational
email (email test):Example
notification
email (desktop):After clicking to unsubscribe from a notification type, the user is asked to confirm:
...
Changes: