{"id":21997652,"url":"https://github.com/dansmaculotte/laravel-mail-template","last_synced_at":"2026-03-06T06:30:49.846Z","repository":{"id":56962202,"uuid":"190886203","full_name":"dansmaculotte/laravel-mail-template","owner":"dansmaculotte","description":"A laravel mail template driver to send emails with","archived":false,"fork":false,"pushed_at":"2022-11-18T14:41:12.000Z","size":87,"stargazers_count":35,"open_issues_count":3,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-28T19:24:13.649Z","etag":null,"topics":["facade","laravel","mail","template"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dansmaculotte.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-08T12:38:00.000Z","updated_at":"2024-12-15T21:15:05.000Z","dependencies_parsed_at":"2023-01-22T01:45:10.908Z","dependency_job_id":null,"html_url":"https://github.com/dansmaculotte/laravel-mail-template","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":"spatie/package-skeleton-laravel","purl":"pkg:github/dansmaculotte/laravel-mail-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dansmaculotte%2Flaravel-mail-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dansmaculotte%2Flaravel-mail-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dansmaculotte%2Flaravel-mail-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dansmaculotte%2Flaravel-mail-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dansmaculotte","download_url":"https://codeload.github.com/dansmaculotte/laravel-mail-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dansmaculotte%2Flaravel-mail-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30164589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T04:43:31.446Z","status":"ssl_error","status_checked_at":"2026-03-06T04:40:30.133Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["facade","laravel","mail","template"],"created_at":"2024-11-29T22:17:35.957Z","updated_at":"2026-03-06T06:30:49.802Z","avatar_url":"https://github.com/dansmaculotte.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A laravel mail template driver to send emails with\n\n[![Latest Version](https://img.shields.io/packagist/v/DansMaCulotte/laravel-mail-template.svg?style=flat-square)](https://packagist.org/packages/dansmaculotte/laravel-mail-template)\n[![Total Downloads](https://img.shields.io/packagist/dt/DansMaCulotte/laravel-mail-template.svg?style=flat-square)](https://packagist.org/packages/dansmaculotte/laravel-mail-template)\n[![Build Status](https://img.shields.io/travis/DansMaCulotte/laravel-mail-template/master.svg?style=flat-square)](https://travis-ci.org/dansmaculotte/laravel-mail-template)\n[![Quality Score](https://img.shields.io/scrutinizer/g/DansMaCulotte/laravel-mail-template.svg?style=flat-square)](https://scrutinizer-ci.com/g/dansmaculotte/laravel-mail-template)\n[![Code Coverage](https://img.shields.io/coveralls/github/DansMaCulotte/laravel-mail-template.svg?style=flat-square)](https://coveralls.io/github/dansmaculotte/laravel-mail-template)\n\n\u003e This package allows you to send emails via mail service providers template's engine.\n\nThere are 5 drivers available:\n\n  - [Mailchimp](https://mailchimp.com/developer/transactional/api/)\n  - [Mailjet](https://dev.mailjet.com/guides/#about-the-mailjet-api)\n  - [Sendgrid](https://sendgrid.com/docs/api-reference/)\n  - [Mailgun](https://documentation.mailgun.com/en/latest/api_reference.html) \n  - [SendinBlue](https://developers.sendinblue.com/docs)\n  \nThere is also and `log` and `null` driver for testing and debug purpose.\n\n## Installation\n\n### Requirements\n\n- PHP 8.1\n\nYou can install the package via composer:\n\n```bash\ncomposer require dansmaculotte/laravel-mail-template\n```\n\nThe package will automatically register itself.\n\nTo publish the config file to config/mail-template.php run:\n\n```php\nphp artisan vendor:publish --provider=\"DansMaCulotte\\MailTemplate\\MailTemplateServiceProvider\"\n```\n\nFinally, install the email service package needed:\n\n- Mailjet\n\n```bash\ncomposer require mailjet/mailjet-apiv3-php\n```\n\n- Mailchimp\n\n```bash\ncomposer require mailchimp/transactional\n```\n\n- SendGrid\n\n```bash\ncomposer require sendgrid/sendgrid\n```\n\n- Mailgun\n\n```bash\ncomposer require mailgun/mailgun-php\n```\n\n- SendinBlue\n\n```bash\ncomposer require sendinblue/api-v3-sdk\n```\n\n## Usage\n\nConfigure your mail template driver and credentials in `config/mail-template.php`.\n\n### Basic\n\nAfter you've installed the package and filled in the values in the config-file working with this package will be a breeze.\nAll the following examples use the facade. Don't forget to import it at the top of your file.\n\n```php\nuse MailTemplate;\n```\n\n```php\n$mailTemplate = MailTemplate::make()\n    -\u003esetSubject('Welcome aboard')\n    -\u003esetFrom(config('mail.name'), config('mail.email'))\n    -\u003esetRecipient('Recipient Name', 'recipient@email.com')\n    -\u003esetLanguage('en')\n    -\u003esetTemplate('welcome-aboard')\n    -\u003esetVariables([\n        'first_name' =\u003e 'Recipient',\n    ]);\n    \n$response = $mailTemplate-\u003esend();\n```\n\nIf an error occurs in the send method it will throw a `SendError::responseError` exception.\n\n### Via Notification\n\nCreate a new notification via php artisan:\n\n```bash\nphp artisan make:notification WelcomeNotification\n```\n\nSet `via` to `MailTemplateChannel`:\n\n```php\n/**\n * Get the notification's delivery channels.\n *\n * @param  mixed  $notifiable\n * @return array\n */\npublic function via($notifiable)\n{\n    return [MailTemplateChannel::class];\n}\n```\n\nImplement `toMailTemplate` method and prepare your template:\n\n```php\npublic function toMailTemplate($notifiable)\n{\n    return MailTemplate::prepare(\n        'Welcome aboard',\n        [\n            'name' =\u003e config('mail.from.name'),\n            'email' =\u003e config('mail.from.email'),\n        ],\n        [\n            'name' =\u003e $notifiable-\u003efull_name,\n            'email' =\u003e $notifiable-\u003eemail,\n        ],\n        $notifiable-\u003epreferredLocale(),\n        'welcome-aboard',\n        [\n            'first_name' =\u003e $notifiable-\u003efirst_name\n        ]\n    );\n}\n```\n\nAnd that's it.\nWhen `MailTemplateChannel` will receive the notification it will automatically call `send` method from `MailTemplate` facade.\n\n### Mailjet Specifics\n\nMailjet API allows to set an email to debug templates. When a template error is\nencountered on email sending, Mailjet sends an error report to this mailbox. To\ndo so, set the email in `config/mail-template.php`, in key\n`mailjet.debug_email`.\n\n### Testing\n\n```bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdansmaculotte%2Flaravel-mail-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdansmaculotte%2Flaravel-mail-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdansmaculotte%2Flaravel-mail-template/lists"}