Pretty Mail by FriendsOfFlarum

License Latest Stable Version OpenCollective

Extiverse

A Flarum extension that allows you to make custom HTML templates for emails!

Big thanks to @clarkwinkelmann for the beginnings of the code!

  • Configure your custom email template from the extension settings
  • This supports all emails sent by Flarum, and 3rd party extensions

Installation

Use Bazaar or install manually with composer:

composer require fof/pretty-mail

Updating

composer update fof/pretty-mail

Important Note

Due to how Flarum handles certain emails, I had to utilize a "hack" to get it to work. This should be fixable in beta 8. Please report any issues you have to our Github.

Default template

Links

An extension by FriendsOfFlarum.

    0.1.0-beta.2

    How to update (Ignore if you haven't installed this before)

    This extension makes use of several very obscure methods in order to function. To insure this extension works properly, please remove it first:

    composer remove reflar/pretty-mail

    Then install it again:

    composer require reflar/pretty-mail

    Finally, run this command:

    composer dump-autoload

    Changelog

    • Added catch for emails send via notification sync
    • Added mail templates for newPost email (Flarum-ext-subscriptions), userMentioned and PostMentioned emails (Flarum-ext-Mentions)
    • Changed settings into a page
    • Pass another variable to the templates that contains the entire forum's css (not recommended unless you want to have bbcode work in emails)
    • Several small locale changes
    • A few small optimizations

    First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack.

      Hi,
      Looks like gmail doesn't like something here -> [Message clipped]

        Kyrne First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack.

        Lol, probably the best way to debug security issues ?

        Kyrne Sure let me know what you need, you want me to open the message or something else?

        gozen This is very "✉ Gmail" specific, see:

        https://www.adestra.com/blog/avoid-gmail-clipping-emails/
        or
        https://kb.mailchimp.com/delivery/deliverability-research/gmail-is-clipping-my-email

        Not sure how @Kyrne want's to tackle this, but if it's something built into an email service provider, I don't think it would be in our best interest to rewrite the logic to limit the max HTML input to so little kilobytes. This wouldn't be fair to those who use email services that have a higher limit or none at all and want to have super fancy email templates.

        I would suggest though that you limit your HTML size to a little under the designated limit described in those articles.

        If you are using images, please resize or compress the image so that it's an appropriate size to fit both it and HTML. If you are using images as a background or gradient, I suggest that you compress the image, find a CSS3 3 hack, or choose a better solution.

        This is not a bug within our extension, this is actually an intended feature, by another 3rd party service provider.

        [INSERT HA HA HA GENERIC PROGRAMMING BUG JOKE REFERENCE]

        gozen so it looks like it's due to passing the entire forum css. Google clips when an email is above 102kb, the emails are about 130kb. I knew it was too good to be true, I'll rework it so that only the important forum css is included. For now, to fix this, remove the $forumStyle variable from the email templates.

          Think these would make good template additions:

          https://github.com/konsav/email-templates

          Kyrne Is there a method of testing the email templates?
          In the past I sent emails using the only User Extension that supported sending emails.
          I was able to create my email template and test it that way.

          I tried copy / pasting one of the included templates into the User email section, but it did not send correcly, looked like broken code.

          So, if I have a template that works and looks good, how do I convert to be used in this extension?

            8 months later
            8 months later

            i got error like:

            ArgumentCountError: Too few arguments to function Illuminate\Filesystem\Filesystem::{closure}(), 1 passed and exactly 2 expected
              File "[internal]", line 0, in call_user_func
              File "/index.php", line 22
                $server->listen();
            ...
            (44 additional frame(s) were not displayed)

              clarkwinkelmann

              Is there any other compatible extension? Or any simple way to change the email text?

              19 days later

              0.1.0

              Extension settings should automatically migrate from reflar/pretty-mail if they exist.

              • Moved to FriendsOfFlarum
              • Updated for beta 8 and later (thanks @glowingblue on GitHub, FriendsOfFlarum/pretty-mail4)
              • Added option to include forum CSS in email (^)
                • may cause issues with some email providers/clients

              Updating

              composer require fof/pretty-mail
              datitisev changed the title to FriendsOfFlarum Pretty Mail .