{"id":19730306,"url":"https://github.com/mecanik/zf3mail","last_synced_at":"2026-07-11T05:30:57.792Z","repository":{"id":62526381,"uuid":"220629264","full_name":"Mecanik/ZF3Mail","owner":"Mecanik","description":"Zend Framework 3 SMTP E-Mail Module","archived":false,"fork":false,"pushed_at":"2021-04-01T20:11:02.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-10T17:49:19.534Z","etag":null,"topics":["zend-3-mail","zend-email-module","zend-framework-3","zend-framework3","zend-mail","zend-smtp-module"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mecanik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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-11-09T10:59:39.000Z","updated_at":"2022-03-12T13:47:31.000Z","dependencies_parsed_at":"2022-11-02T14:16:09.704Z","dependency_job_id":null,"html_url":"https://github.com/Mecanik/ZF3Mail","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mecanik%2FZF3Mail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mecanik%2FZF3Mail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mecanik%2FZF3Mail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mecanik%2FZF3Mail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mecanik","download_url":"https://codeload.github.com/Mecanik/ZF3Mail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241055895,"owners_count":19901676,"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":["zend-3-mail","zend-email-module","zend-framework-3","zend-framework3","zend-mail","zend-smtp-module"],"created_at":"2024-11-12T00:15:53.261Z","updated_at":"2025-10-26T23:04:13.165Z","avatar_url":"https://github.com/Mecanik.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZF3Mail - Zend Framework 3 SMTP E-Mail Module\n [![Latest Stable Version](https://poser.pugx.org/mecanik/zf3mail/v/stable)](https://packagist.org/packages/mecanik/zf3mail)\n [![License](https://poser.pugx.org/mecanik/zf3mail/license)](https://packagist.org/packages/mecanik/zf3mail)\n [![Total Downloads](https://poser.pugx.org/mecanik/zf3mail/downloads)](https://packagist.org/packages/mecanik/zf3mail)\n \nDescription\n------------\nE-Mail Module to make your development much faster and easier when sending HTML emails.\n\n### Current Features:\n* Service (e-mail SMTP transport) using the \"Zend 3\" method\n* Ability to use custom templates from `phtml` files\n* Ability to use custom templates with custom layouts per email, from `phtml` files\n* Ability to add custom headers\n* Plugin for usage in all your controllers\n* Plugin for usage in view templates (if needed)\n* PHP 7 friendly (and required)\n* No other dependencies (than Zend Framework 3)\n\n\nInstallation\n------------\nInstallation is done via Composer:\n\n```\ncomposer require mecanik/zf3mail\n```\n\nSMTP Configuration\n----------------\nCreate config/autoload/zf3mail.global.php with the content:\n\n```php\n\u003c?php\nreturn [\n   'zf3mail_config' =\u003e [\n       'smtp_login' =\u003e [\n           'name' =\u003e 'smtp.hostname.net',\n           'host' =\u003e 'smtp.hostname.net',\n           'connection_class' =\u003e 'login',\n           'connection_config' =\u003e [\n               'username' =\u003e '',\n               'password' =\u003e '',\n               'ssl' =\u003e 'tls',\n           ],\n       ],\n       \n       // By default, the Message class assumes ASCII encoding for your email. I've set UTF-8, but change as neccessary.\n       'encoding' =\u003e 'UTF-8',\n       \n       // Default layout used for all HTML emails. This can be replaced per email basis by specifying 'layout' array parameter when composing emails.\n       'default_layout' =\u003e 'application/emails/default_layout.phtml',\n   ],\n];\n```\n\nModule Configuration/Usage\n----------------\n\nLoad the module (in any order):\n\n```\n'Mecanik\\ZF3Mail'\n```\n\nThere are 3 ways to use this module:\n\n* By injecting the service into any of your controllers (via factory): \n\n```\n    $mailService = $container-\u003eget(\\Mecanik\\ZF3Mail\\Service\\ZF3Mail::class);\n```\n\n* By just using it as a plugin inside any of your controllers:\n\n```\n$this-\u003ezf3mail()\n```\n\n* By just using it as a plugin inside any of your views:\n\n```\n$this-\u003ezf3mail()\n```\n\nHowever since the module is automatically already registered as plugins, I would recommend to just use the plugin in any controller you want.\n\nComposing e-mails\n----------------\n\nWhen composing emails you must specify a couple of things like 'from', 'to, 'subject', template, and all this is done via the easiest way: arrays.\n\nYou can also add extra headers, and overwrite the \"default\" layout if needed for each email.\n\n```php\n\u003c?php\n$headers = [      \n   'from' =\u003e 'My Name \u003cnoreply@mywebsite.com\u003e',\n   'subject' =\u003e 'Hello there',\n   'to' =\u003e 'Neo \u003cneo@matrix.com\u003e',\n   // Additional headers can be specified like:\n   // 'X-API-Key', 'FOO-BAR-BAZ-BAT'\n];\n\n$template = [\n   'content_template' =\u003e 'application/emails/order-received.phtml',\n   //'layout' =\u003e 'application/emails/layout.phtml',\n];\n\n$email = $this-\u003ezf3mail()-\u003ecompose($headers, $template, $parameters);\n```\n\nWhen you are done composing, just simply send it:\n\n```\n$this-\u003ezf3mail()-\u003esend($email);\n```\n\nLayouts explained\n----------------\n\nAs you noticed in the configuration, all HTML emails sent will use a \"default\" layout:\n\n```\n'default_layout' =\u003e 'application/emails/default_layout.phtml',\n```\n\nThis can be overwritten for every email you send as seen above, but it must contain the variable to echo the content:\n\n```php\n \u003c?php echo $this-\u003eemail_content ?\u003e\n```\n\nThat's all for now, enjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmecanik%2Fzf3mail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmecanik%2Fzf3mail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmecanik%2Fzf3mail/lists"}