{"id":43725741,"url":"https://github.com/netcore/module-email","last_synced_at":"2026-02-05T09:03:45.554Z","repository":{"id":57025411,"uuid":"108122264","full_name":"netcore/module-email","owner":"netcore","description":"Email module for managing automated emails","archived":false,"fork":false,"pushed_at":"2018-07-04T08:23:24.000Z","size":276,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-18T14:12:22.859Z","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/netcore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-24T12:16:36.000Z","updated_at":"2018-07-04T08:22:32.000Z","dependencies_parsed_at":"2022-08-23T15:00:30.145Z","dependency_job_id":null,"html_url":"https://github.com/netcore/module-email","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/netcore/module-email","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netcore%2Fmodule-email","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netcore%2Fmodule-email/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netcore%2Fmodule-email/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netcore%2Fmodule-email/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netcore","download_url":"https://codeload.github.com/netcore/module-email/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netcore%2Fmodule-email/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29117916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T05:31:32.482Z","status":"ssl_error","status_checked_at":"2026-02-05T05:31:29.075Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-02-05T09:03:44.730Z","updated_at":"2026-02-05T09:03:45.537Z","avatar_url":"https://github.com/netcore.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Module - Email\nThis module was made for easy management of automated emails and email campaigns.\n\n## Pre-installation\n\nThis package is part of Netcore CMS ecosystem and is only functional in a project that has following packages\ninstalled:\n\n1. https://github.com/netcore/netcore\n2. https://github.com/netcore/module-admin\n3. https://github.com/netcore/module-translate\n4. https://github.com/netcore/module-user\n5. https://github.com/netcore/module-setting\n\n### Installation\n\n - Require this package using composer\n```\n    composer require netcore/module-email\n```\n\n - Publish assets/configuration/migrations\n```\n    php artisan module:publish Email\n    php artisan module:publish-config Email\n    php artisan module:publish-migration Email\n    php artisan migrate\n```\n\n - Add automated emails command to scheduling in \"app/Console/Kernel.php\"\n```\n    $schedule-\u003ecommand('automated-emails:send')-\u003eeveryMinute();\n```\n\n- Set queue driver to redis\n\n- In your supervisor configuration set --timeout to 3600 or larger if a project will have large user base to send campaigns to\n\n- Add `Modules\\User\\Traits\\ReplaceableAttributes` trait to your `User` model and set public property `$replaceable` which you want dynamically use in email templates:\n\n```\npublic $replaceable = [\n    'first_name',\n    'last_name',\n    'email'\n];\n``` \n\nand set `$replaceablePrefix` to prefix the replaceable attributes.\n\n- Add \"getFilters\" and \"getFilterQuery\" methods to User model, like so:\n```\n    public function getFilters()\n    {\n        return [\n            'is_email_verified' =\u003e [\n                'name'   =\u003e 'Email verified?',\n                'type'   =\u003e 'select', // Available types: text, select, multi-select, from-to\n                'values' =\u003e [-1 =\u003e 'Not important', 1 =\u003e 'Yes', 0 =\u003e 'No']\n            ],\n            'country'           =\u003e [\n                'name'   =\u003e 'Country',\n                'type'   =\u003e 'multi-select', // Available types: text, select, multi-select, from-to\n                'values' =\u003e Country::all()-\u003emapWithKeys(function ($country) {\n                    return [\n                        $country-\u003eid =\u003e $country-\u003ename\n                    ];\n                })\n            ],\n        ];\n    }\n    \n    public function getFilterQuery()\n    {\n        $filters = request()-\u003eget('filters', []);\n        $query = User::select('id', 'email');\n        \n        foreach ($this-\u003egetFilters() as $field =\u003e $filter) {\n            $data = (isset($filters[$field])) ? $filters[$field] : -1;\n            \n            if ($data \u003c 0) {\n                continue;\n            }\n    \n            if ($filter['type'] == 'multi-select') {\n                $query-\u003ewhereHas($field, function ($q) use ($data) {\n                    $q-\u003ewhereIn('id', $data);\n                });\n            } elseif ($filter['type'] == 'from-to') {\n\n                if (($data['from'] \u0026\u0026 $data['to']) \u0026\u0026 $data['to'] \u003e $data['from']) {\n                    $query-\u003ewhereBetween($field, [$data['from'], $data['to']]);\n                }\n\n            } else {\n                $query-\u003ewhere($field, $data);\n            }\n        }\n    \n        return $query;\n    }\n``` \n \n### Configuration\n\n - Configuration file is available at config/netcore/module-email.php\n \n ### Seeding automated emails\n \n ```php\n    use Modules\\Email\\Models\\AutomatedEmail;\n    use Netcore\\Translator\\Helpers\\TransHelper;\n    \n    $emails = [\n         [\n             'key'          =\u003e 'verify_email',\n             'period'       =\u003e 'now',\n             'type'         =\u003e 'static', // Available types: static, period, interval\n             'is_active'    =\u003e true,\n             'translations' =\u003e [\n                 'name' =\u003e 'Email verification',\n                 'text' =\u003e 'Please verify your email by clicking on the link: \u003ca href=\"[VERIFICATION_URL]\"\u003e[VERIFICATION_URL]\u003c/a\u003e'\n             ]\n         ]\n     ];\n    \n     foreach ($emails as $email) {\n         $emailModel = AutomatedEmail::create(array_except($email, 'translations'));\n    \n         $translations = [];\n         foreach (TransHelper::getAllLanguages() as $language) {\n             $translations[$language-\u003eiso_code] = $email['translations'];\n         }\n         \n         $emailModel-\u003eupdateTranslations($translations);\n     }\n ```\n\n### Usage\n\n- Add/remove email to/from subscriptions list\n```php\n    email()-\u003esubscribe('example@example.com');\n    email()-\u003eunsubscribe('example@example.com');\n```\n\n- Send automated email\n```php\n    email()-\u003esend('verify_email', $user, [\n        'VERIFICATION_URL' =\u003e $verificationUrl\n    ]);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetcore%2Fmodule-email","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetcore%2Fmodule-email","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetcore%2Fmodule-email/lists"}