{"id":25253323,"url":"https://github.com/mailpace/mailpace-swiftmailer","last_synced_at":"2025-10-27T00:30:56.586Z","repository":{"id":40426168,"uuid":"371655061","full_name":"mailpace/mailpace-swiftmailer","owner":"mailpace","description":"The official Swiftmailer transport for MailPace","archived":false,"fork":false,"pushed_at":"2022-05-09T12:16:39.000Z","size":40,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-10T06:16:05.119Z","etag":null,"topics":[],"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/mailpace.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null}},"created_at":"2021-05-28T09:51:21.000Z","updated_at":"2022-07-28T08:54:54.000Z","dependencies_parsed_at":"2022-08-02T15:15:30.128Z","dependency_job_id":null,"html_url":"https://github.com/mailpace/mailpace-swiftmailer","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":"spatie/package-skeleton-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailpace%2Fmailpace-swiftmailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailpace%2Fmailpace-swiftmailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailpace%2Fmailpace-swiftmailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailpace%2Fmailpace-swiftmailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mailpace","download_url":"https://codeload.github.com/mailpace/mailpace-swiftmailer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238416229,"owners_count":19468456,"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":[],"created_at":"2025-02-12T04:59:01.462Z","updated_at":"2025-10-27T00:30:51.287Z","avatar_url":"https://github.com/mailpace.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The official Swiftmailer transport for MailPace\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/mailpace/mailpace-swiftmailer.svg?style=flat-square)](https://packagist.org/packages/mailpace/mailpace-swiftmailer)\n[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/mailpace/mailpace-swiftmailer/Tests)](https://github.com/mailpace/mailpace-swiftmailer/actions?query=workflow%3ATests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/mailpace/mailpace-swiftmailer/Check%20\u0026%20fix%20styling?label=code%20style)](https://github.com/mailpace/mailpace-swiftmailer/actions?query=workflow%3A\"Check+%26+fix+styling\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/mailpace/mailpace-swiftmailer.svg?style=flat-square)](https://packagist.org/packages/mailpace/mailpace-swiftmailer)\n\n\n[MailPace](https://mailpace.com) lets you send transactional emails from your app over an easy to use API.\n\nThis MailPace PHP Package is a transport for SwiftMailer to send emails via [MailPace](https://mailpace.com) to make sending emails from PHP apps super simple. You can use this with popular frameworks such as Laravel, Codeigniter and Symfony to send transactional emails, or with a standalone PHP app.\n\nThis package uses the MailPace HTTPS [/send endpoint](https://docs.mailpace.com/reference/send) to send the email - which is generally faster and more reliable than SMTP, although you can of course use SMTP to send out emails from your PHP app without installing this package if you prefer.\n\n## Pre-requisites\n\nYou will need an MailPace account with a verified domain and organization with an active plan.\n\n## Installation\n\nInstall the package via composer:\n\n```bash\ncomposer require mailpace/mailpace-swiftmailer\n```\n### Account Setup \n\nSet up an account at [MailPace](https://app.mailpace.com/users/sign_up) and complete the Onboarding steps\n\n### Configure the Package\n\nFirst you will need to retrieve your API token for your sending domain from [MailPace](https://app.mailpace.com). You can find it under Organization -\u003e Domain -\u003e API Tokens\n\nYou'll need to store this API token somewhere in your app/runtime, we recommend Environment Variables for this, and the examples below assume that you have an environment variable called `OHMYSMTP_API_TOKEN` that contains your API token\n\n#### Sending without a framework\n\n```php\n\u003c?php\nrequire_once('./vendor/autoload.php');\n\n$transport = new MailpaceSwiftmailerTransport(env('OHMYSMTP_API_TOKEN'));\n$mailer = new Swift_Mailer($transport);\n\n$message = (new Swift_Message('A transactional email from MailPace!'))\n  -\u003esetFrom(['php@yourdomain.com' =\u003e 'Your Name'])\n  -\u003esetTo(['someone@example.com'])\n  -\u003esetBody('\u003ch1\u003eHTML content\u003c/h1\u003e', 'text/html')\n  -\u003eaddPart('Text Body','text/plain');\n\n// Attachments\n$data = 'Raw Attachment Data';\n$attachment = new Swift_Attachment($data, 'attachment.txt', 'text/plain');\n$message-\u003eattach($attachment);\n\n// Email Tags\n$headers = $message-\u003egetHeaders();\n$headers-\u003eaddTextHeader('MailPace-Tag', 'tag-1');\n$headers-\u003eaddTextHeader('MailPace-Tag', 'tag with spaces');\n\n$mailer-\u003esend($message);\n?\u003e\n```\n\n#### Sending with Laravel\n\nTo send with Laravel you need to make a few small tweaks, but it really only takes a moment.\n\n1. Add mailpace to the `config/mail.php` configuration file:\n\n```php\n'mailpace' =\u003e [\n    'transport' =\u003e 'mailpace',\n],\n```\n\n\n2. Add the following to your `config/services.php` configuration file:\n\n```php\n'mailpace' =\u003e [\n  'apiToken' =\u003e env('OHMYSMTP_API_TOKEN'),\n]\n```\n\n3. In `config/app.php`, add the following to the providers array:\n\n```php\nApp\\Providers\\MailpaceServiceProvider::class,\n``` \n\nand remove / comment out the line:\n\n```php\n Illuminate\\Mail\\MailServiceProvider::class,\n ```\n\n4. In your `.env` file (or wherever you store environment variables), change the `MAIL_MAILER` variable as follows:\n\n`MAIL_MAILER=mailpace`\n\n5. Create a new file called `MailpaceServiceProvider.php` in `App/Providers` with the following contents:\n\n```php\n\u003c?php\n\nnamespace App\\Providers;\n\nuse Illuminate\\Mail\\MailManager;\nuse Illuminate\\Mail\\MailServiceProvider;\nuse Mailpace\\MailpaceSwiftmailer\\MailpaceSwiftmailerTransport;\n\nclass MailpaceServiceProvider extends MailServiceProvider\n{\n    protected function registerIlluminateMailer()\n    {\n        $this-\u003eapp-\u003esingleton('mail.manager', function ($app) {\n            $manager = new MailManager($app);\n            $this-\u003eregisterOhMySmtpTransport($manager);\n            return $manager;\n        });\n    }\n\n    protected function registerOhMySmtpTransport(MailManager $manager) {\n        $manager-\u003eextend('mailpace', function ($config) {\n            if (! isset($config['apiToken'])) {\n                $config = $this-\u003eapp['config']-\u003eget('services.mailpace', []);\n            }\n            return new MailpaceSwiftmailerTransport($config['apiToken']);\n        });\n    }\n}\n\n```\nAfter completing the above steps, all email will be sent via MailPace.\n\n## Support\n\nFor support please check the [MailPace Documentation](https://docs.mailpace.com) or contact us at support@mailpace.com\n\n## Contributing\n\nPlease ensure to add a test for any changes. To run the tests:\n\n`composer test`\n\nPull requests always welcome\n\n## License\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailpace%2Fmailpace-swiftmailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmailpace%2Fmailpace-swiftmailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailpace%2Fmailpace-swiftmailer/lists"}