Package: templates-email
Generated from api/packages/templates-email
Source: api/packages/templates-email · imported version 0.1.69. The sections after the README are extracted from the code on every docs build.
README
Section titled “README”Package for email notifications with editable templates (for important user-related events)
Purpose
Section titled “Purpose”This package allows you to create email notifications for events emitted in Laravel app.
Each notification is created as a class describing available variables that can be used in Template (which will be created in database and editable through admin panel). This class must be registered using Template facade from Template package, where you specify which Event it is associated with and which Channel it is sent through (e.g. Email channel when defined in this package).
Installing
Section titled “Installing”composer require ulams/templates-emailphp artisan db:migratephp artisan db:seed --class="Ulams\TemplatesEmail\Database\Seeders\TemplatesEmailSeeder"
Dependencies
Section titled “Dependencies”Defining Templates
Section titled “Defining Templates”- Create event which triggers sending email using specified template. This event must implement method getUser() returning User model from LMS Core package.
- Create Class defining template variables, which you will use in email notification,
- Associate your class describing template variables with event and channel through which notifications should be sent. Use
Ulams\Templates\Facades\Template::register(Event class, Ulams\TemplatesEmail\Core\EmailChannel::class, Variable class); - Register template in db for admin panel or used
/api/admin/templates, better described in Template package
Mjml (pre)rendering
Section titled “Mjml (pre)rendering”- Emails are written using MJML, which then is prerendered into HTML when saving a Template (so that sending an email does not call renderer for each message).
- To render MJML you need to either:
- install
mjmlnpm package and configure path to executable binary in this package configbinary_pathkey - register to MJML API and configure api id & secret in this package config file
- install
Run ./vendor/bin/phpunit --filter 'Ulams\\TemplatesEmail\\Tests' to run tests. See tests folder as it contains a basic implementation of Variable (or Template description) class with minimal customisation - a quite good starting point for creating your own.
Permissions
Section titled “Permissions”No Permissions defined for this package.
More documentation in the package
Section titled “More documentation in the package”- api/packages/templates-email/ADMIN.md
- api/packages/templates-email/docs/edit.png
- api/packages/templates-email/docs/list.png
- api/packages/templates-email/docs/menu.png
API endpoints
Section titled “API endpoints”None.
Permissions
Section titled “Permissions”None.
Settings
Section titled “Settings”Registered with AdministrableConfig::registerConfig (editable in the admin panel under Configuration → Settings).
| Key | Rules | Public | Read-only |
|---|---|---|---|
ulams_templates_email.mjml.use_api |
required, bool | no | |
ulams_templates_email.mjml.api_id |
required, string | no | |
ulams_templates_email.mjml.api_secret |
required, string | no | |
ulams_templates_email.mjml.default_template |
required, string, new MjmlRule() | no |
Events
Section titled “Events”None.
Notification templates registered here
Section titled “Notification templates registered here”| Event | Channel | Variables |
|---|---|---|
AssignToProduct |
AssignToProductVariables |
|
AssignToProductable |
AssignToProductableVariables |
|
UnassignProduct |
UnassignProductVariables |
|
UnassignProductable |
UnassignProductableVariables |
|
AccountMustBeEnableByAdmin |
VerifyUserAccountVariables |
|
AccountConfirmed |
AccountConfirmedVariables |
|
UserAddedToGroup |
UserAddedToGroupVariables |
|
UserRemovedFromGroup |
UserRemovedFromGroupVariables |
|
PasswordChanged |
PasswordChangedVariables |
|
AccountMustBeEnableByAdmin |
VerifyUserAccountVariables |
|
ForgotPassword |
ResetPasswordVariables |
|
AccountRegistered |
VerifyEmailVariables |
|
AccountDeleted |
AccountDeletedVariables |
|
AccountBlocked |
AccountBlockedVariables |
|
AccountDeletionRequested |
AccountDeletionRequestedVariables |
|
ProductAttached |
ProductAttachedVariables |
|
OrderCreated |
OrderCreatedVariables |
|
ConsultationAccessEnquiryAdminCreatedEvent |
ConsultationAccessEnquiryAdminCreatedVariables |
|
ConsultationAccessEnquiryDisapprovedEvent |
ConsultationAccessEnquiryDisapprovedVariables |
|
ConsultationAccessEnquiryApprovedEvent |
ConsultationAccessEnquiryApprovedVariables |
|
ApprovedTermWithTrainer |
ApprovedTermWithTrainerVariables |
|
ApprovedTerm |
ApprovedTermVariables |
|
RejectTermWithTrainer |
RejectTermWithTrainerVariables |
|
RejectTerm |
RejectTermVariables |
|
ReportTerm |
ReportTermVariables |
|
ReminderAboutTerm |
ReminderAboutTermVariables |
|
ReminderTrainerAboutTerm |
ReminderTrainerAboutTermVariables |
|
ChangeTerm |
ChangeTermVariables |
|
CourseAccessEnquiryAdminCreatedEvent |
CourseAccessEnquiryAdminCreatedVariables |
|
CourseDeadlineSoon |
DeadlineIncomingVariables |
|
CourseFinished |
UserFinishedCourseVariables |
|
CourseAssigned |
UserAssignedToCourseVariables |
|
CourseUnassigned |
UserUnassignedFromCourseVariables |
|
CoursedPublished |
PublishedCourseVariables |
|
CourseStarted |
StartedCourseVariables |
|
CourseAccessStarted |
AccessStartedCourseVariables |
|
CourseAccessFinished |
AccessFinishedCourseVariables |
|
TopicFinished |
TopicFinishedCourseVariables |
|
UlamsImportedNewUserTemplateEvent |
ImportedNewUserVariables |
|
UpdateProposalReady |
UpdateProposalReadyVariables |
|
SourceCheckFailing |
SourceCheckFailingVariables |
|
CourseContentUpdated |
CourseContentUpdatedVariables |
|
PaymentRegistered |
PaymentRegisteredVariables |
|
PaymentFailed |
PaymentFailedVariables |
|
PaymentSuccess |
PaymentSuccessVariables |
|
PaymentCancelled |
PaymentCanceledVariables |
|
TaskAssignedEvent |
TaskAssignedVariables |
|
TaskCompleteUserConfirmationEvent |
TaskCompleteUserConfirmationVariables |
|
TaskCompleteRequestEvent |
TaskCompleteRequestVariables |
|
TaskOverdueEvent |
TaskOverdueVariables |
|
TaskIncompleteEvent |
TaskIncompleteVariables |
|
TaskNoteCreatedEvent |
TaskNoteCreatedVariables |
|
ManuallyTriggeredEvent |
UserVariables |
|
ProjectSolutionCreatedEvent |
ProjectSolutionCreatedVariables |
|
TopicTypeChanged |
TopicTypeChangedVariables |
|
ProcessVideoStarted |
VideoProcessStartedVariables |
|
ProcessVideoFailed |
VideoProcessFailedVariables |
|
ProcessVideoFinished |
VideoProcessFinishedVariables |
|
ProcessVideoState |
VideoProcessStateVariables |
|
ReminderAboutTerm |
ReminderAboutTermVariables |
|
WebinarTrainerAssigned |
WebinarTrainerAssignedVariables |
|
WebinarTrainerUnassigned |
WebinarTrainerUnassignedVariables |
|
YtProblem |
YtProblemVariables |
Artisan commands
Section titled “Artisan commands”None.
Scheduled jobs
Section titled “Scheduled jobs”None.
Environment variables read
Section titled “Environment variables read”MJML_API_ID, MJML_API_SECRET, MJML_API_URL, MJML_BINARY_PATH, MJML_USE_API