{"id":22018421,"url":"https://github.com/biohzrdmx/mailer","last_synced_at":"2026-04-27T12:33:45.633Z","repository":{"id":27501864,"uuid":"30982238","full_name":"biohzrdmx/mailer","owner":"biohzrdmx","description":"Mailing abstraction layer, with support for custom providers","archived":false,"fork":false,"pushed_at":"2017-11-16T18:53:03.000Z","size":149,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T16:17:22.528Z","etag":null,"topics":["hummingbird-lite","mandrill","php","phpmailer","smtp","wrapper"],"latest_commit_sha":null,"homepage":null,"language":null,"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/biohzrdmx.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-18T19:24:04.000Z","updated_at":"2017-12-01T20:11:20.000Z","dependencies_parsed_at":"2022-09-02T09:01:22.044Z","dependency_job_id":null,"html_url":"https://github.com/biohzrdmx/mailer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohzrdmx%2Fmailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohzrdmx%2Fmailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohzrdmx%2Fmailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohzrdmx%2Fmailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biohzrdmx","download_url":"https://codeload.github.com/biohzrdmx/mailer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245081784,"owners_count":20557843,"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":["hummingbird-lite","mandrill","php","phpmailer","smtp","wrapper"],"created_at":"2024-11-30T05:12:08.692Z","updated_at":"2026-04-27T12:33:40.607Z","avatar_url":"https://github.com/biohzrdmx.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mailer\n\nMailing abstraction layer for [Hummingbird Lite](https://github.com/biohzrdmx/hummingbird-lite), with support for custom providers.\n\nOther flavors (WordPress maybe?) coming soon!\n\n## Basic usage:\n\n### Creating the message\n\nMailer defines a `MailerMessage` class, which holds all the required fields to describe an email message.\n\nJust include the library and create a `MailerMessage` instance, filling the desired fields:\n\n\t# Include the library and at least one provider\n\tinclude $site-\u003ebaseDir('/external/mailer.inc.php');\n\tinclude $site-\u003ebaseDir('/external/provider/mandrill.provider.php');\n\tinclude $site-\u003ebaseDir('/external/provider/smtp.provider.php');\n\n\t# Create a MailerMessage object and set the subject, from, to, contents, attachments, etc.\n\t$message = MailerMessage::newInstance()\n\t\t-\u003esetSubject('Test')\n\t\t-\u003esetFrom( array('test@mailinator' =\u003e 'Me') )\n\t\t-\u003esetTo( array('test@mailinator' =\u003e 'Me') )\n\t\t-\u003esetTemplate($site-\u003ebaseDir('/parts/mail-templates/basic-email.html'))\n\t\t-\u003esetImages(array('email_header' =\u003e $site-\u003ebaseDir('/images/email-header.jpg')))\n\t\t-\u003esetAttachments(array('Test.doc' =\u003e $site-\u003ebaseDir('/test.doc')))\n\t\t-\u003esetReplacements(array('%email-footer%' =\u003e 'Test'))\n\t\t-\u003esetContents('\u003ch2\u003eHey you\u003c/h2\u003e');\n\nIn the example above, we added a bunch of things, such as images, attached files, replacement strings, etc.\n\nFor each `MailerMessage` instance you may define:\n\n- **Subject** - The message's subject\n- **From** - The message's sender\n- **To** - The message's destination\n- **Contents** - The message's contents\n- **Template** - An optional HTML template to use for the message\n- **Attachments** - Attached files\n- **Images** - Embedded images for inline display\n- **Replacements** - String replacements for your template (for example, changing %site% for the URL of your site)\n\nThat way, we've defined an abstract message that could be sent by any provider we choose.\n\n### Sending the message\n\nMailer includes two providers: classic SMTP and Mandrill\n\nTo send messages using the SMTP provider you should install the [PHPMailer library](https://github.com/PHPMailer/PHPMailer) and pass the SMTP credentials through the `$options` array.\n\n\t$options = array(\n\t\t'host' =\u003e 'smtp.test.com',\n\t\t'port' =\u003e '587',\n\t\t'user' =\u003e 'smtp@test.com',\n\t\t'pass' =\u003e 'password123'\n\t);\n\tMailer::send($message, 'smtp', $options);\n\n*Pro tip: Download the PHPMailer ZIP and place `PHPMailerAutoload.php` and the three `class.*.php` files into `lib/PHPMailer`.*\n\nMandrill is even easier, you just need to install the [Mandrill PHP SDK](https://bitbucket.org/mailchimp/mandrill-api-php/downloads) and an API Key which you'll pass in the `$options` array.\n\n\t$options = array(\n\t\t'key' =\u003e 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n\t);\n\tMailer::send($message, 'mandrill', $options);\n\n*Pro tip: Download the Mandrill PHP SDK ZIP and extract the contents of the `src` folder into `lib/Mandrill`.*\n\nAnd that kids, is how we send emails with Mailer.\n\n## Extending the library\n\n### Creating providers\n\nYou may refer to each of the bundled providers to see how they do work internally.\n\nIn short, you must:\n\n- Create you provider class, extending `MailerProvider`\n- Implement the `send` method in your derived class. This implementation depends on the specific provider mechanics.\n\nWe've included Mandrill and SMTP providers, but if you want to contribute by adding another provider (for example Swift Mailer or Mailgun, etc.) you're strongly encouraged to do so.\n\nIf you implement another provider please send me a push request so I can improve the providers pool.\n\n## Credits\n\nLead coder: biohzrdmx \u003c[github.com/biohzrdmx](https://github.com/biohzrdmx)\u003e\n\n## License\n\nCopyright © 2017 biohzrdmx\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiohzrdmx%2Fmailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiohzrdmx%2Fmailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiohzrdmx%2Fmailer/lists"}