Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.idea
.vscode
.DS_Store
storage/framework
launch.json
.env
.env.*
!.env.example
storage
tmp
23 changes: 23 additions & 0 deletions config/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,28 @@ func init() {
"username": config.Env("MAIL_USERNAME"),

"password": config.Env("MAIL_PASSWORD"),

// Template Configuration
//
// This controls template rendering for email views. Template engines are cached
// globally and support both built-in drivers and custom implementations via factories.
//
// Available Drivers: "html", "custom"
"template": map[string]any{
"default": config.Env("MAIL_TEMPLATE_ENGINE", "html"),
"engines": map[string]any{
"html": map[string]any{
"driver": "html",
"path": config.Env("MAIL_VIEWS_PATH", "resources/views/mail"),
},
// Example custom template engine:
// "blade": map[string]any{
// "driver": "custom",
// "via": func() (mail.Template, error) {
// return NewBladeTemplateEngine(), nil
// },
Comment on lines +59 to +61

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The example for a custom template engine is a great addition. However, if a developer uncomments it as-is, the code will fail to compile because mail.Template is an unresolved reference and NewBladeTemplateEngine is undefined. To improve the developer experience and make this example more self-contained, I suggest adding inline comments to guide the user on what needs to be imported and implemented.

Suggested change
// "via": func() (mail.Template, error) {
// return NewBladeTemplateEngine(), nil
// },
// "via": func() (mail.Template, error) { // `mail` is from "github.com/goravel/framework/contracts/mail"
// return NewBladeTemplateEngine(), nil // `NewBladeTemplateEngine` is your implementation.
// },

// },
},
},
})
}
Loading