{"id":13828196,"url":"https://github.com/craigpaul/laravel-postmark","last_synced_at":"2025-07-09T05:31:57.365Z","repository":{"id":35095196,"uuid":"80351847","full_name":"craigpaul/laravel-postmark","owner":"craigpaul","description":"A Postmark adapter for Laravel","archived":false,"fork":false,"pushed_at":"2024-02-19T00:29:14.000Z","size":417,"stargazers_count":204,"open_issues_count":2,"forks_count":23,"subscribers_count":5,"default_branch":"3.x","last_synced_at":"2024-10-28T06:08:03.073Z","etag":null,"topics":["email","laravel","postmark","transactional-emails"],"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/craigpaul.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"mvdnbrk"}},"created_at":"2017-01-29T14:53:06.000Z","updated_at":"2024-10-12T11:11:58.000Z","dependencies_parsed_at":"2024-01-18T05:18:41.352Z","dependency_job_id":"e415a54a-9c14-484f-896e-860f3133c583","html_url":"https://github.com/craigpaul/laravel-postmark","commit_stats":{"total_commits":349,"total_committers":10,"mean_commits":34.9,"dds":0.6017191977077364,"last_synced_commit":"0101be3e0f2b67503b7b84718208469725f7dcb2"},"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigpaul%2Flaravel-postmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigpaul%2Flaravel-postmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigpaul%2Flaravel-postmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigpaul%2Flaravel-postmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craigpaul","download_url":"https://codeload.github.com/craigpaul/laravel-postmark/tar.gz/refs/heads/3.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225486577,"owners_count":17481930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["email","laravel","postmark","transactional-emails"],"created_at":"2024-08-04T09:02:36.142Z","updated_at":"2024-11-20T07:31:42.490Z","avatar_url":"https://github.com/craigpaul.png","language":"PHP","funding_links":["https://github.com/sponsors/mvdnbrk"],"categories":["PHP"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003ca href=\"https://postmarkapp.com\" target=\"_blank\"\u003e\u003cimg src=\"https://postmarkapp.com/images/logo.svg\" alt=\"Postmark\" width=\"240\" height=\"52\"\u003e\u003c/a\u003e\n\n# Laravel Postmark\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Tests][ico-tests]][link-tests]\n[![StyleCI][ico-style-ci]][link-style-ci]\n[![Total Downloads][ico-downloads]][link-downloads]\n\n\u003e [Postmark](https://postmarkapp.com) is the easiest and most reliable way to be sure your important transactional emails get to your customer's inbox.\n\n## Upgrading\n\nPlease see [UPGRADE](UPGRADE.md) for details.\n\n## Installation\n\nYou can install the package via composer:\n\n``` bash\n$ composer require coconutcraig/laravel-postmark\n```\n\nThe package will automatically register itself.\n\n## Usage\n\nUpdate your `.env` file by adding your server key and set your mail driver to `postmark`.\n\n```php\nMAIL_MAILER=postmark\nPOSTMARK_TOKEN=YOUR-SERVER-KEY-HERE\n```\n\nThat's it! The mail system continues to work the exact same way as before and you can switch out Postmark for any of the pre-packaged Laravel mail drivers (smtp, mailgun, log, etc...).\n\n\u003e Remember, when using Postmark the sending address used in your emails must be a [valid Sender Signature](http://support.postmarkapp.com/category/45-category) that you have already configured.\n\n## Postmark Templates\n\n### Notification\n\nPostmark offers a fantastic templating service for you to utilize instead of maintaining your templates within your Laravel application. If you would like to take advantage of that, this package offers an extension on the base `MailMessage` provided out of the box with Laravel. Within a Laravel notification, you can do the following to start taking advantage of Postmark templates.\n\n```php\nuse CraigPaul\\Mail\\TemplatedMailMessage;\n\npublic function toMail($notifiable)\n{\n    return (new TemplatedMailMessage)\n        -\u003eidentifier(8675309)\n        -\u003einclude([\n            'name' =\u003e 'Customer Name',\n            'action_url' =\u003e 'https://example.com/login',\n        ]);\n}\n```\n\n### Mailable\n\nIt is also possible to use templated notifications via an extension on the base `Mailable` provided out of the box with Laravel.\n\n```php\nuse CraigPaul\\Mail\\TemplatedMailable;\nuse Illuminate\\Support\\Facades\\Mail;\n\n$mailable = (new TemplatedMailable())\n    -\u003eidentifier(8675309)\n    -\u003einclude([\n        'name' =\u003e 'Customer Name',\n        'action_url' =\u003e 'https://example.com/login',\n    ]);\n\nMail::to('mail@example.com')-\u003esend($mailable);\n```\n\n\u003e You may also utilize an alias instead of the template identifier by using the `-\u003ealias()` method in both cases.\n\n## Postmark Tags\n\nIf you rely on categorizing your outgoing emails using Tags in Postmark, you can simply add a header within your Mailable class's build method.\n\n```php\nuse Symfony\\Component\\Mailer\\Header\\TagHeader;\nuse Symfony\\Component\\Mime\\Email;\n\npublic function build()\n{\n    $this-\u003ewithSymfonyMessage(function (Email $message) {\n        $message-\u003egetHeaders()-\u003eadd(new TagHeader('value'))\n    });\n}\n```\n\n## Postmark Metadata\n\nSimilar to tags, you can also include [metadata](https://postmarkapp.com/support/article/1125-custom-metadata-faq) by adding a header.\n\n```php\nuse Symfony\\Component\\Mailer\\Header\\MetadataHeader;\nuse Symfony\\Component\\Mime\\Email;\n\npublic function build()\n{\n    $this-\u003ewithSymfonyMessage(function (Email $message) {\n        $message-\u003egetHeaders()-\u003eadd(new MetadataHeader('field', 'value'));\n        $message-\u003egetHeaders()-\u003eadd(new MetadataHeader('another-field', 'another value'));\n    });\n}\n```\n\nIn this case, the following object will be sent to Postmark as metadata.\n\n```\n{\n    \"field\": \"value\",\n    \"another-field\", \"another value\"\n}\n```\n\n## Postmark Servers\n\nOut of the box, we determine the Postmark server you send to using a configuration variable set within the environment you have deployed to. This works for most use cases, but if you have the need or desire to determine the Postmark server at runtime, you can supply a header during the sending process.\n\n```php\nuse CraigPaul\\Mail\\PostmarkServerTokenHeader;\nuse Symfony\\Component\\Mime\\Email;\n\npublic function build()\n{\n    $this-\u003ewithSymfonyMessage(function (Email $message) {\n        $message-\u003egetHeaders()-\u003eadd(new PostmarkServerTokenHeader('POSTMARK_TOKEN'))\n    });\n}\n```\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) and [CONDUCT](.github/CODE_OF_CONDUCT.md) for details.\n\n## Security Vulnerabilities\n\nPlease review our [security policy](.github/SECURITY.md) on how to report security vulnerabilities.\n\n## Credits\n\n- [Craig Paul][link-author-paul]\n- [Mark van den Broek][link-author-mark]\n- [All Contributors][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/coconutcraig/laravel-postmark.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-tests]: https://img.shields.io/github/workflow/status/craigpaul/laravel-postmark/tests/main?label=tests\u0026style=flat-square\n[ico-style-ci]: https://styleci.io/repos/80351847/shield?branch=main\n[ico-downloads]: https://img.shields.io/packagist/dt/coconutcraig/laravel-postmark.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/coconutcraig/laravel-postmark\n[link-tests]: https://github.com/craigpaul/laravel-postmark/actions?query=workflow%3Atests\n[link-style-ci]: https://styleci.io/repos/80351847\n[link-downloads]: https://packagist.org/packages/coconutcraig/laravel-postmark\n[link-author-paul]: https://github.com/craigpaul\n[link-author-mark]: https://github.com/mvdnbrk\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigpaul%2Flaravel-postmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraigpaul%2Flaravel-postmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigpaul%2Flaravel-postmark/lists"}