{"id":22753138,"url":"https://github.com/shockwavemk/magento2-module-mail","last_synced_at":"2025-07-25T20:06:57.620Z","repository":{"id":57049692,"uuid":"48877108","full_name":"shockwavemk/magento2-module-mail","owner":"shockwavemk","description":"Magento2 module enhances the magento2 capabilities to send transactional mails with external services like external smtp servers, mailgun, etc., adds mail archiving and attachment sending capabilities","archived":false,"fork":false,"pushed_at":"2017-12-15T09:18:23.000Z","size":402,"stargazers_count":10,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-04-14T15:14:33.112Z","etag":null,"topics":["attachment","magento2","magento2-extension","magento2-module","mail","mailgun"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/shockwavemk/magento2-module-mail","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/shockwavemk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-01T12:06:08.000Z","updated_at":"2020-07-06T07:02:27.000Z","dependencies_parsed_at":"2022-08-23T17:50:33.840Z","dependency_job_id":null,"html_url":"https://github.com/shockwavemk/magento2-module-mail","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shockwavemk%2Fmagento2-module-mail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shockwavemk%2Fmagento2-module-mail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shockwavemk%2Fmagento2-module-mail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shockwavemk%2Fmagento2-module-mail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shockwavemk","download_url":"https://codeload.github.com/shockwavemk/magento2-module-mail/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248904637,"owners_count":21180835,"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":["attachment","magento2","magento2-extension","magento2-module","mail","mailgun"],"created_at":"2024-12-11T06:09:07.440Z","updated_at":"2025-04-14T15:14:41.020Z","avatar_url":"https://github.com/shockwavemk.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Magento 2 enhanced mailing module\n\nThis module enhances the magento 2 capabilities to send transactional mails.\nIn a plain magento 2 installation it is neither possible to track and manage \ntransactional emails sent by magento 2 system, nor it is possible to store \nmails locally or at backup service providers.\n\nThis mailing module distinguishes between parts of email processing:\n\n- A mail transport system which takes care of transport of outgoing mails \n  to a mail service provider and retrieval of returning meta data for \n  mails entities.\n  \n- A mail storeage system which takes care of storing the data of outgoing\n  mails and its metadata on file-systems.\n  \n\nAs well the implemented transport system as the storeage system consist\nof a configurable base class for Magento 2 and a second class for dynamic \nloaded plugin classes which performs the actual transport.\nTherefore it is possible to keep the rich basic functionality of this mail \nmodule and to enhance it by vendor specific functionality.\n\n\n## Installation\n\nAdd the module to your composer file.\n\n```json\n{\n  \"require\": {    \n    \"shockwavemk/magento2-module-mail\": \"dev-master\"\n  }\n}\n\n```\n\nInstall the module with composer.\n\n```bash\n\n    composer update\n\n```\n\nOn succeed, install the module via bin/magento console.\n\n```bash\n\n    bin/magento cache:clean\n    \n    bin/magento module:enable Shockwavemk_Mail_Base\n    \n    bin/magento setup:upgrade\n\n```\n\n\n\n\n\n## Features\n\n### Mail sending over configurable plugins\n\nTransport and storeage configuration can be easily done via store config.\nInstalled plug-ins for transport and storeage can be selected at this point.\n\n![](./docs/magento2-config-mail-enhancement.png)\n\nSupported vendors (so far):\n\nTransport:\n\n- Any SMTP server\n- Mailgun\n\nStorage:\n\n- Local server storeage\n- Dropbox\n\n\n### Storeage of mail meta data in database\n\n\n\n\n### Storeage of mail data as json files\n\nEach mail sent by magento 2 is stored individual as json file.\n\n![](./docs/magento2-mail-stored-as-json.png)\n\nAdditional a rendered version of each mail is stored as .hmtl file.\nThis reduces loading times on review and enables external storeage\nsystems to preview content stored.\n\nThe default storeage stores all files sent by magento2 in a so called\n\"spool\" folder. The mail data will stay at this local server path until \nit is deleted or moved.\n\n![](./docs/local-storeage-for-mails-as-json.png)\n\nWith an installed storeage plugin a cronjob will automatically take care\nto move all stored mails to your secure external storeage location.\nEven if your server is reinstalled or you have to clean up your magento installation:\nThe conversation with you customers is safe.\n\n\n\n### Enhanced admin customer management by transactional mail review\n\nThe customer administration is enhanced by an additional menu tab.\n\nSelect customer in main admin menu:\n\n![](./docs/magento2-customer-menu.png)\n\n\nThe marketing - user content - tab is enhanced by an additional menu point.\nOn this new section you can review and resend all (guest and customer) mails\nsent by the magento2 system.\n\n\n![](./docs/magento2-guest-email-review-and-resending.jpg)\n\n\n\n### Re-Sending of transactional mails. Re-Calculated or Re-Sending of stored mail data\n\nThis extension keeps track of each email sent from store.\nFor each of them it is possible to trigger an resending.\n\n![](./docs/magento2-mail-resending-and-recalculation.png)\n\n\n### Attachment handling and storeage of sent files\n\nThe base mail module supports attachment sending.\nMagento2 does not support native file attachment handling, therefore you need to\nadd some code on your own.\n\nIn order to add files from filesystem, you need to change your email\nsending strategy to \"async\".\n\nYou have to modify/override the EmailSenderHandler class.\n\n```php\n\n    /**\n         * @param \\Magento\\Sales\\Model\\Order\\Email\\Sender                          $emailSender\n         * @param \\Magento\\Sales\\Model\\ResourceModel\\EntityAbstract                $entityResource\n         * @param \\Magento\\Sales\\Model\\ResourceModel\\Collection\\AbstractCollection $entityCollection\n         * @param \\Magento\\Framework\\App\\Config\\ScopeConfigInterface               $globalConfig\n         * @param Config                                                           $documentConfig\n         * @param ObjectManagerInterface                                           $objectManager\n         */\n        public function __construct(\n            \\Magento\\Sales\\Model\\Order\\Email\\Sender $emailSender,\n            \\Magento\\Sales\\Model\\ResourceModel\\EntityAbstract $entityResource,\n            \\Magento\\Sales\\Model\\ResourceModel\\Collection\\AbstractCollection $entityCollection,\n            \\Magento\\Framework\\App\\Config\\ScopeConfigInterface $globalConfig,\n            ObjectManagerInterface $objectManager\n        )\n        {\n            parent::__construct($emailSender, $entityResource, $entityCollection, $globalConfig);\n\n            $this-\u003eobjectManager = $objectManager;\n            $this-\u003edocumentConfig = $documentConfig;\n\n            // Dynamic typed build a collection for attachments for later usage\n\n            // Should be extended from \\Magento\\Framework\\Data\\Collection\n            $this-\u003eattachmentCollection = $this-\u003eobjectManager-\u003eget(\n                'Shockwavemk\\Mail\\Base\\Model\\Mail\\AttachmentCollectionInterface'\n            );\n        }\n\n\n\n    /**\n     * Handles asynchronous email sending\n     *\n     * @return void\n     * @throws \\RuntimeException\n     * @throws \\Exception\n     */\n    public function sendEmails()\n    {\n        /** @var \\Magento\\Sales\\Model\\AbstractModel $item */\n        foreach ($this-\u003eentityCollection-\u003egetItems() as $item) {\n\n        // add this code\n\n            // Create a new attachment\n\n            if (!is_null($attachmentFilePath)) {\n                /** @var \\Shockwavemk\\Mail\\Base\\Model\\Mail\\AttachmentInterface|\\Magento\\Framework\\DataObject $attachment */\n                $attachment = $this-\u003eobjectManager\n                    -\u003ecreate('Shockwavemk\\Mail\\Base\\Model\\Mail\\AttachmentInterface');\n\n                // Do not transfer binary data to mail entity at this point: The mailer can handle file reading on its own\n                $attachment-\u003esetFilePath($attachmentFilePath);\n\n                // Add attachment to attachment collection\n                // Let the mailer later decide how to handle them\n                $this-\u003eattachmentCollection-\u003eaddItem($attachment);\n            }\n\n        }\n\n    }\n\n```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshockwavemk%2Fmagento2-module-mail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshockwavemk%2Fmagento2-module-mail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshockwavemk%2Fmagento2-module-mail/lists"}