diff --git a/.gitattributes b/.gitattributes index 0d97623..f64fcd6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,11 +1,13 @@ -/tests export-ignore -/docs export-ignore -/client/src export-ignore -/.gitattributes export-ignore -/.gitignore export-ignore -/.php_cs.dist -/phpcs.xml.dist -/phpstan.neon.dist -/phpunit.xml.dist -/.waratah export-ignore -/README.md export-ignore +/tests export-ignore +/docs export-ignore +/client/src export-ignore +/.editorconfig export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php-cs-fixer.dist.php export-ignore +/phpunit.xml.dist export-ignore +/.waratah export-ignore +/code-of-conduct.md export-ignore +/CONTRIBUTING.md export-ignore +/README.md export-ignore +/thirdparty/postmark-templates export-ignore diff --git a/.gitignore b/.gitignore index 3fe0b45..5a6b194 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,5 @@ /client/node_modules /vendor/ .DS_Store -/.php_cs.cache -/resources/ -/_resources/ -/public/ -/assets/ +/.php-cs-fixer.cache /tests/__output/ diff --git a/.php_cs.dist b/.php-cs-fixer.dist.php similarity index 91% rename from .php_cs.dist rename to .php-cs-fixer.dist.php index 4faac27..f9b7107 100644 --- a/.php_cs.dist +++ b/.php-cs-fixer.dist.php @@ -7,8 +7,8 @@ $finder = PhpCsFixer\Finder::create() ->in(__DIR__); -return PhpCsFixer\Config::create() - ->setRules([ +$config = new PhpCsFixer\Config(); +return $config->setRules([ '@PSR2' => true, 'array_indentation' => true, 'array_syntax' => ['syntax' => 'short'], diff --git a/README.md b/README.md index 8719dbd..2968428 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ ## Structured email handling for Silverstripe -The goal of this module is to produce simple and easy-to-digest emails ([more](./docs/en/001_index.md)). The templates used are based on the [Postmark Transactional Email Templates](https://github.com/wildbit/postmark-templates). +The goal of this module is to produce simple and easy-to-digest emails ([more](./docs/en/001_index.md)). The templates used are based on the [Postmark Transactional Email Templates](https://github.com/ActiveCampaign/postmark-templates). -> :warning: This module is under active development and shouldn't be used in production just yet as there are probably bugs. Test results, pull requests and feedback are welcome. - -The `StructuredEmail` extends the `Email` class. You can use it standalone or you may wish to inject StructuredEmail as the Email class for your project using `Injector`. +The `StructuredEmail` class extends the `Email` class. You can use it standalone or you may wish to inject StructuredEmail as the Email class for your project using `Injector`. For specific core emails, it will attempt to detect the purpose of the email based on the template name: @@ -20,7 +18,7 @@ TODO: ### Existing templates -If the class encounters a complete HTML document in the email, it will use HTML contained within the `
` tag as the email content. +If the class encounters a complete HTML document in the email, it will use HTML contained within the `` tag of that document as the email content. ## Schema.org @@ -29,7 +27,7 @@ If the class encounters a complete HTML document in the email, it will use HTML ## Resources + E-mail support across clients: https://www.caniemail.com -+ Postmark templates: https://github.com/wildbit/postmark-templates ++ Postmark templates: https://github.com/ActiveCampaign/postmark-templates ## Quick example @@ -75,7 +73,7 @@ composer require nswdpc/silverstripe-structured-email + [dpcdigital@NSWDPC:~$](https://dpc.nsw.gov.au) -The source of the HTML email templates is the [Postmark templates project](https://github.com/wildbit/postmark-templates) +The source of the HTML email templates is the [Postmark templates project](https://github.com/ActiveCampaign/postmark-templates) ## Bugtracker diff --git a/composer.json b/composer.json index 0bae02e..c374dd9 100644 --- a/composer.json +++ b/composer.json @@ -17,20 +17,18 @@ } ], "require": { - "silverstripe/framework": "^4", + "silverstripe/framework": "^4.10", "league/html-to-markdown": "^5", - "spatie/schema-org": "^3.4", - "nswdpc/silverstripe-taggable-notifications": "dev-master" + "spatie/schema-org": "^3.5", + "nswdpc/silverstripe-taggable-notifications": "^0.3" }, "suggest": { "ext-xml": "Use DOMDocument to process HTML documents", "ext-tidy": "Use tidy to process HTML documents" }, "require-dev": { - "phpunit/phpunit": "^5.7", - "squizlabs/php_codesniffer": "^3.0", - "friendsofphp/php-cs-fixer": "^2.18", - "symbiote/silverstripe-phpstan": "^4", + "phpunit/phpunit": "^9.5", + "friendsofphp/php-cs-fixer": "^3", "silverstripe/sqlite3": "^2" } } diff --git a/docs/en/001_index.md b/docs/en/001_index.md index 2846f37..e3db372 100644 --- a/docs/en/001_index.md +++ b/docs/en/001_index.md @@ -10,15 +10,15 @@ This module handles the templating of the email, leaving you to figure out what We add: -+ Standard, proven email templates based on https://github.com/wildbit/postmark-templates ++ Standard, proven email templates based on https://github.com/ActiveCampaign/postmark-templates + A Structured Email class + An Injectable email decorator containing standard CSS values + Structured template parts allowing you to override as required ++ 🧫 Automated text/plain content creation (as markdown) ### Planned features -+ ⚠️ 🧫 Schema.org support -+ ⚠️ 🧫 Automated text/plain content creation (as markdown) ++ ⚠️ 🧫 improved Schema.org support ### Stretch goals diff --git a/docs/en/003_decorator.md b/docs/en/003_decorator.md index 6b0b026..8d73906 100644 --- a/docs/en/003_decorator.md +++ b/docs/en/003_decorator.md @@ -67,7 +67,7 @@ print get_class($decorator); ### Set the layout type -A layout type allows you some control over the HTML width ([more](https://github.com/wildbit/mailmason/wiki/Project-Structure#layouts)) +A layout type allows you some control over the HTML width ([more](https://github.com/ActiveCampaign/mailmason/wiki/Project-Structure#layouts)) + basic-full = full width + basic = single centred column diff --git a/docs/en/004_schemaorg.md b/docs/en/004_schemaorg.md index be11ef9..5adc54b 100644 --- a/docs/en/004_schemaorg.md +++ b/docs/en/004_schemaorg.md @@ -22,6 +22,7 @@ $email->setViewAction( 'https://confirm.example.com?token=suitably-long-token' ); ``` +Internally, a `\Spatie\SchemaOrg\ViewAction` will be created using the name and URL provided. This will result in the following HTML snippet in the template: @@ -50,6 +51,7 @@ You can also define a generic action: ```php name('Carry out this action') ->handler( diff --git a/phpcs.xml.dist b/phpcs.xml.dist deleted file mode 100644 index fe58f6f..0000000 --- a/phpcs.xml.dist +++ /dev/null @@ -1,11 +0,0 @@ - -
-<%t StructuredEmail.THANKS 'Thanks '%>
-
-<% if $SiteConfig %>
-
-{$SiteConfig.Title}
-<% end_if %>
-<% with $Top.EmailDecorator %>
-<% if $SignOffLink %>
-
-{$SignOffLink.XML}
-<% end_if %>
-<% end_with %>
-
- © 2021 [Product Name]. All rights reserved.
[Company Name, LLC]
| ||||||||||
+ |
- Success button
+ Success button
|
|
Thanks,
-
[Sender Name] and the [Product Name] Team
P.S. Need help getting started? Check out our help documentation. Or, just reply to this email with any questions or issues you have. The [Product Name] support team is always excited to help you.
10% off your next purchase!@@ -595,7 +599,7 @@
- Use this discount now...
+ Use this discount now...
|
|
© 2021 [Product Name]. All rights reserved.
[Company Name, LLC]
1234 Street Rd.
diff --git a/thirdparty/postmark-templates/templates-inlined/basic-full/example/content.txt b/thirdparty/postmark-templates/templates-inlined/basic-full/example/content.txt
index b21497d..7858957 100644
--- a/thirdparty/postmark-templates/templates-inlined/basic-full/example/content.txt
+++ b/thirdparty/postmark-templates/templates-inlined/basic-full/example/content.txt
@@ -6,7 +6,7 @@ This is example text for the preheader set via the YAML front-matter for each em
Escaped Handlebars Brackets
***************************
-Working with templates, you'll occasionally need to put some Mustachio ( https://github.com/wildbit/mustachio ) code in your Handlebars templates. To prevent the Handlebars processing from attempting to process your Mustachio code, you'll need to escape the curly braces by adding a backslash just before the opening curly braces.
+Working with templates, you'll occasionally need to put some Mustachio ( https://github.com/activecampaign/mustachio ) code in your Handlebars templates. To prevent the Handlebars processing from attempting to process your Mustachio code, you'll need to escape the curly braces by adding a backslash just before the opening curly braces.
\{{ something }} will turn into {{ something }}
@@ -81,7 +81,7 @@ Example Closing
***************
Thanks,
-[Sender Name] and the [Product Name] Team
+[Sender Name] and the [Product Name] team
P.S. Need help getting started? Check out our help documentation. Or, just reply to this email with any questions or issues you have. The [Product Name] support team is always excited to help you.
@@ -111,8 +111,6 @@ If you’re having trouble clicking the confirm account button, copy and paste t
{{action_url}} ( {{ action_url }} )
-© 2021 [Product Name]. All rights reserved.
-
[Company Name, LLC]
1234 Street Rd.
diff --git a/thirdparty/postmark-templates/templates-inlined/basic-full/invoice/content.html b/thirdparty/postmark-templates/templates-inlined/basic-full/invoice/content.html
index 15c0d52..f9160d9 100644
--- a/thirdparty/postmark-templates/templates-inlined/basic-full/invoice/content.html
+++ b/thirdparty/postmark-templates/templates-inlined/basic-full/invoice/content.html
@@ -1,5 +1,5 @@
-
+
- Pay Invoice + Pay Invoice |
Cheers,
-
The [Product Name] Team
- © 2021 [Product Name]. All rights reserved.
[Company Name, LLC]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+ |
If you do not use [Product Name] or did not request a password reset, please ignore this email or contact support if you have questions. Thanks,
- The [Product Name] team
|
- Upgrade your account + Upgrade your account |
Thanks,
-
[Sender Name] and the [Product Name] Team
P.S. If you have any questions or need any help, please don't hesitate to reach out. You can reply to this email or join us on live chat during business hours.
© 2021 [Product Name]. All rights reserved.
[Company Name, LLC]
1234 Street Rd.
diff --git a/thirdparty/postmark-templates/templates-inlined/basic-full/trial-expiring/content.txt b/thirdparty/postmark-templates/templates-inlined/basic-full/trial-expiring/content.txt
index 08643bf..4ba8ead 100644
--- a/thirdparty/postmark-templates/templates-inlined/basic-full/trial-expiring/content.txt
+++ b/thirdparty/postmark-templates/templates-inlined/basic-full/trial-expiring/content.txt
@@ -23,12 +23,10 @@ Close your account ( {{ close_account_url }} ) - You can close your account and
Regardless of your choice, we want to say thank you for trying [Product Name]. We know it's an investment of your time, and we appreciate you giving us a chance.
Thanks,
-[Sender Name] and the [Product Name] Team
+[Sender Name] and the [Product Name] team
P.S. If you have any questions or need any help, please don't hesitate to reach out. You can reply to this email or join us on live chat during business hours.
-© 2021 [Product Name]. All rights reserved.
-
[Company Name, LLC]
1234 Street Rd.
diff --git a/thirdparty/postmark-templates/templates-inlined/basic-full/user-invitation/content.html b/thirdparty/postmark-templates/templates-inlined/basic-full/user-invitation/content.html
index d5bdf55..c3af6bf 100644
--- a/thirdparty/postmark-templates/templates-inlined/basic-full/user-invitation/content.html
+++ b/thirdparty/postmark-templates/templates-inlined/basic-full/user-invitation/content.html
@@ -1,5 +1,5 @@
-
+
- Set up account + Set up account |
Welcome aboard,
-
The [Product Name] Team
P.S. Need help getting started? Check out our help documentation.
- © 2021 [Product Name]. All rights reserved.
[Company Name, LLC]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+ |
If you have any questions, feel free to email our customer success team. (We're lightning quick at replying.) We also offer live chat during business hours.Thanks,
- [Sender Name] and the [Product Name] team P.S. Need immediate help getting started? Check out our help documentation. Or, just reply to this email, the [Product Name] support team is always ready to help!
|
- Pay Invoice + Pay Invoice |
Cheers,
-
The [Product Name] Team
- © 2021 [Product Name]. All rights reserved.
[Company Name, LLC]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+ |
If you do not use [Product Name] or did not request a password reset, please ignore this email or contact support if you have questions. Thanks,
- The [Product Name] team
|
- Upgrade your account + Upgrade your account |
Thanks,
-
[Sender Name] and the [Product Name] Team
P.S. If you have any questions or need any help, please don't hesitate to reach out. You can reply to this email or join us on live chat during business hours.
© 2021 [Product Name]. All rights reserved.
[Company Name, LLC]
1234 Street Rd.
diff --git a/thirdparty/postmark-templates/templates-inlined/basic/trial-expiring/content.txt b/thirdparty/postmark-templates/templates-inlined/basic/trial-expiring/content.txt
index 08643bf..4ba8ead 100644
--- a/thirdparty/postmark-templates/templates-inlined/basic/trial-expiring/content.txt
+++ b/thirdparty/postmark-templates/templates-inlined/basic/trial-expiring/content.txt
@@ -23,12 +23,10 @@ Close your account ( {{ close_account_url }} ) - You can close your account and
Regardless of your choice, we want to say thank you for trying [Product Name]. We know it's an investment of your time, and we appreciate you giving us a chance.
Thanks,
-[Sender Name] and the [Product Name] Team
+[Sender Name] and the [Product Name] team
P.S. If you have any questions or need any help, please don't hesitate to reach out. You can reply to this email or join us on live chat during business hours.
-© 2021 [Product Name]. All rights reserved.
-
[Company Name, LLC]
1234 Street Rd.
diff --git a/thirdparty/postmark-templates/templates-inlined/basic/user-invitation/content.html b/thirdparty/postmark-templates/templates-inlined/basic/user-invitation/content.html
index c5d86eb..e91f9f1 100644
--- a/thirdparty/postmark-templates/templates-inlined/basic/user-invitation/content.html
+++ b/thirdparty/postmark-templates/templates-inlined/basic/user-invitation/content.html
@@ -1,5 +1,5 @@
-
+
- Set up account + Set up account |
Welcome aboard,
-
The [Product Name] Team
P.S. Need help getting started? Check out our help documentation.
- © 2021 [Product Name]. All rights reserved.
[Company Name, LLC]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+ |
If you have any questions, feel free to email our customer success team. (We're lightning quick at replying.) We also offer live chat during business hours.Thanks,
- [Sender Name] and the [Product Name] team P.S. Need immediate help getting started? Check out our help documentation. Or, just reply to this email, the [Product Name] support team is always ready to help!
|
- Pay Invoice + Pay Invoice |
Cheers,
-
The [Product Name] Team
- © 2021 [Product Name]. All rights reserved.
[Company Name, LLC]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+ |
If you do not use [Product Name] or did not request a password reset, please ignore this email or contact support if you have questions. Thanks,
- The [Product Name] team
|
- Upgrade your account + Upgrade your account |
Thanks,
-
[Sender Name] and the [Product Name] Team
P.S. If you have any questions or need any help, please don't hesitate to reach out. You can reply to this email or join us on live chat during business hours.
© 2021 [Product Name]. All rights reserved.
[Company Name, LLC]
1234 Street Rd.
diff --git a/thirdparty/postmark-templates/templates-inlined/plain/trial-expiring/content.txt b/thirdparty/postmark-templates/templates-inlined/plain/trial-expiring/content.txt
index 08643bf..4ba8ead 100644
--- a/thirdparty/postmark-templates/templates-inlined/plain/trial-expiring/content.txt
+++ b/thirdparty/postmark-templates/templates-inlined/plain/trial-expiring/content.txt
@@ -23,12 +23,10 @@ Close your account ( {{ close_account_url }} ) - You can close your account and
Regardless of your choice, we want to say thank you for trying [Product Name]. We know it's an investment of your time, and we appreciate you giving us a chance.
Thanks,
-[Sender Name] and the [Product Name] Team
+[Sender Name] and the [Product Name] team
P.S. If you have any questions or need any help, please don't hesitate to reach out. You can reply to this email or join us on live chat during business hours.
-© 2021 [Product Name]. All rights reserved.
-
[Company Name, LLC]
1234 Street Rd.
diff --git a/thirdparty/postmark-templates/templates-inlined/plain/user-invitation/content.html b/thirdparty/postmark-templates/templates-inlined/plain/user-invitation/content.html
index 3343413..8661031 100644
--- a/thirdparty/postmark-templates/templates-inlined/plain/user-invitation/content.html
+++ b/thirdparty/postmark-templates/templates-inlined/plain/user-invitation/content.html
@@ -1,5 +1,5 @@
-
+
- Set up account + Set up account |
Welcome aboard,
-
The [Product Name] Team
P.S. Need help getting started? Check out our help documentation.
- © 2021 [Product Name]. All rights reserved.
[Company Name, LLC]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+ |
If you have any questions, feel free to email our customer success team. (We're lightning quick at replying.) We also offer live chat during business hours.Thanks,
- [Sender Name] and the [Product Name] team P.S. Need immediate help getting started? Check out our help documentation. Or, just reply to this email, the [Product Name] support team is always ready to help!
|