{"id":19270802,"url":"https://github.com/activecampaign/swiftmailer-postmark","last_synced_at":"2025-04-06T15:13:35.349Z","repository":{"id":27888844,"uuid":"31380308","full_name":"ActiveCampaign/swiftmailer-postmark","owner":"ActiveCampaign","description":"The Official Swiftmailer Transport for Postmark.","archived":false,"fork":false,"pushed_at":"2022-09-05T08:52:27.000Z","size":83,"stargazers_count":52,"open_issues_count":8,"forks_count":28,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-03-30T13:09:59.483Z","etag":null,"topics":["email","mail","postmark","postmark-integrations"],"latest_commit_sha":null,"homepage":"https://postmarkapp.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ActiveCampaign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-26T17:51:27.000Z","updated_at":"2025-03-08T05:01:22.000Z","dependencies_parsed_at":"2022-09-04T08:50:40.691Z","dependency_job_id":null,"html_url":"https://github.com/ActiveCampaign/swiftmailer-postmark","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ActiveCampaign%2Fswiftmailer-postmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ActiveCampaign%2Fswiftmailer-postmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ActiveCampaign%2Fswiftmailer-postmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ActiveCampaign%2Fswiftmailer-postmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ActiveCampaign","download_url":"https://codeload.github.com/ActiveCampaign/swiftmailer-postmark/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247500469,"owners_count":20948880,"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","mail","postmark","postmark-integrations"],"created_at":"2024-11-09T20:27:28.082Z","updated_at":"2025-04-06T15:13:35.331Z","avatar_url":"https://github.com/ActiveCampaign.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swiftmailer-postmark\n[![Build Status](https://circleci.com/gh/ActiveCampaign/swiftmailer-postmark.svg?style=shield)](https://circleci.com/gh/ActiveCampaign/swiftmailer-postmark)\n\nAn official Swiftmailer Transport for Postmark.\n\nSend mail through Postmark from your favorite PHP frameworks!\n\n## Usage\n\n### 1. Include this package in your project:\n\n```bash\ncomposer require wildbit/swiftmailer-postmark\n```\n### 2. Use the transport to send a message:\n\n```php\n\u003c?php\n//import the transport from the standard composer directory:\nrequire_once('./vendor/autoload.php');\n\n$transport = new \\Postmark\\Transport('\u003cSERVER_TOKEN\u003e');\n$mailer = new Swift_Mailer($transport);\n\n//Instantiate the message you want to send.\n$message = (new Swift_Message('Hello from Postmark!'))\n  -\u003esetFrom(['john@example.com' =\u003e 'John Doe'])\n  -\u003esetTo(['jane@example.com'])\n  -\u003esetBody('\u003cb\u003eA really important message from our sponsors.\u003c/b\u003e', 'text/html')\n  -\u003eaddPart('Another important message from our sponsors.','text/plain');\n\n//Add some attachment data:\n$attachmentData = 'Some attachment data.';\n$attachment = new Swift_Attachment($attachmentData, 'my-file.txt', 'application/octet-stream');\n\n$message-\u003eattach($attachment);\n\n//Send the message!\n$mailer-\u003esend($message);\n?\u003e\n```\n\n### 3. Throw exceptions on Postmark api errors:\n\n```php\n$transport = new \\Postmark\\Transport('\u003cSERVER_TOKEN\u003e');\n$transport-\u003eregisterPlugin(new \\Postmark\\ThrowExceptionOnFailurePlugin());\n\n$message = new Swift_Message('Hello from Postmark!');\n$mailer-\u003esend($message); // Exception is throw when response !== 200\n```\n\n### 4. Use default headers:\n\nYou can set default headers at Transport-level, to be set on every message, unless overwritten.\n\n```php\n$defaultHeaders = ['X-PM-Tag' =\u003e 'my-tag'];\n\n$transport = new \\Postmark\\Transport('\u003cSERVER_TOKEN\u003e', $defaultHeaders);\n\n$message = new Swift_Message('Hello from Postmark!');\n\n// Overwriting default headers\n$message-\u003egetHeaders()-\u003eaddTextHeader('X-PM-Tag', 'custom-tag');\n```\n\n### 5. Setting the Message Stream:\n\nBy default, the \"outbound\" transactional stream will be used when sending messages.\n\n```php\n// Change the default stream for every message via Default Headers\n$transport = new \\Postmark\\Transport('\u003cSERVER_TOKEN\u003e', ['X-PM-Message-Stream' =\u003e 'your-custom-stream']);\n\n$message = new Swift_Message('Hello from Postmark!');\n\n// Overwrite the default stream for a specific message by setting the header\n$message-\u003egetHeaders()-\u003eaddTextHeader('X-PM-Message-Stream', 'another-stream');\n```\n\n### 6. Getting the Postmark Message ID after sending\nAfter sending the mail to Postmark, it is possible to get the Postmark ID.\n\n```php \n$transport = new \\Postmark\\Transport('\u003cSERVER_TOKEN\u003e', $defaultHeaders);\n$mailer = new Swift_Mailer($transport);\n\n$message = new Swift_Message('Hello from Postmark!');\n\n$mailer-\u003esend($message);\n\n$postmarkID = $message-\u003egetHeaders()-\u003eget('X-PM-Message-Id')-\u003egetValue();\n```\n\n## Releasing a new version\n\nSwiftmailer Transport uses [packagist](https://packagist.org/packages/wildbit/swiftmailer-postmark).\nTo publish a new version, simply create a new release on GitHub tagged with the version number.\n\n## Notes:\n\n- The Transport uses the [Postmark API](https://postmarkapp.com/developer) internally to send mail, via the [/email endpoint](https://postmarkapp.com/developer/api/email-api#send-a-single-email). Other sending features such as Batch sending or sending via Templates are currently not supported by this library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factivecampaign%2Fswiftmailer-postmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factivecampaign%2Fswiftmailer-postmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factivecampaign%2Fswiftmailer-postmark/lists"}