{"id":23882600,"url":"https://github.com/kisphp/simple-mail","last_synced_at":"2025-02-23T01:24:24.674Z","repository":{"id":57007019,"uuid":"53726278","full_name":"kisphp/simple-mail","owner":"kisphp","description":"Simple and quick solution to send emails to users with a minimal configuration","archived":false,"fork":false,"pushed_at":"2019-08-14T13:54:58.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-04T02:56:16.171Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"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/kisphp.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":"2016-03-12T10:39:44.000Z","updated_at":"2021-11-08T19:45:42.000Z","dependencies_parsed_at":"2022-08-21T14:31:01.463Z","dependency_job_id":null,"html_url":"https://github.com/kisphp/simple-mail","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisphp%2Fsimple-mail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisphp%2Fsimple-mail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisphp%2Fsimple-mail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisphp%2Fsimple-mail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kisphp","download_url":"https://codeload.github.com/kisphp/simple-mail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240255611,"owners_count":19772655,"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-01-04T02:56:18.228Z","updated_at":"2025-02-23T01:24:24.646Z","avatar_url":"https://github.com/kisphp.png","language":"PHP","readme":"# Kisphp Simple mailer\n\n[![Build Status](https://travis-ci.org/kisphp/simple-mail.svg?branch=master)](https://travis-ci.org/kisphp/simple-mail)\n[![codecov.io](https://codecov.io/github/kisphp/simple-mail/coverage.svg?branch=master)](https://codecov.io/github/kisphp/simple-mail?branch=master)\n\n[![Latest Stable Version](https://poser.pugx.org/kisphp/simple-mail/v/stable)](https://packagist.org/packages/kisphp/simple-mail)\n[![Total Downloads](https://poser.pugx.org/kisphp/simple-mail/downloads)](https://packagist.org/packages/kisphp/simple-mail)\n[![License](https://poser.pugx.org/kisphp/simple-mail/license)](https://packagist.org/packages/kisphp/simple-mail)\n[![Monthly Downloads](https://poser.pugx.org/kisphp/simple-mail/d/monthly)](https://packagist.org/packages/kisphp/simple-mail)\n\nQuick send emails with swift mailer for your website with a very simple implementation.\nBy default is configured to send through google.\n\n\n## Installation\n\n```bash\ncomposer require kisphp/simple-mail\n```\n\n## Configuration\n\nIf you already use composer into your project, then the required libraries will be automatically included.\nOther way you'll have to include autoloader into your php file:\n\n```php\nrequire_once '/path/to/vendor/autoload.php';\n```\n\nFirst step you need to do, is to create a Configuration class that will implement `Kisphp\\Mail\\MailConfigInterface;`.\n\n```php\n\u003c?php\n\nnamespace Demo;\n\nuse Kisphp\\Mail\\MailConfigInterface;\n\nclass DemoMailConfig implements MailConfigInterface\n{\n    public function getHost()\n    {\n        return 'ssl://smtp.gmail.com';\n    }\n\n    public function getPort()\n    {\n        return 465;\n    }\n\n    public function getSenderUsername()\n    {\n        return 'your-email-address@gmail.com';\n    }\n\n    public function getSenderPassword()\n    {\n        return 'your account password';\n    }\n\n    public function getMailEncryptionType()\n    {\n        return null;\n    }\n\n    public function getFromEmail()\n    {\n        return 'no-reply@example.com';\n    }\n\n    public function getFromName()\n    {\n        return 'My website';\n    }\n}\n```\n\nNext you'll need to create extend `AbstractMailerFactory` class to use your configuration:\n\n```php\nclass DemoMailerFactory extends AbstractMailerFactory\n{\n    /**\n     * @return DemoMailConfig\n     */\n    public function createMailConfig()\n    {\n        return new DemoMailConfig();\n    }\n}\n```\n\nAnd from here you can start to use it:\n\n```php\n\u003c?php\n\n$messenger = DemoMailerFactory::createMailer();\n\n// recipients\n$recipients = [\n    'user_1@example.com' =\u003e 'User name 1',\n    'user_2@example.com' =\u003e 'User name 2',\n];\n\n$subject = 'Testing mail';\n$htmlMessage = 'this is my \u003cb\u003emessage\u003c/b\u003e for you';\n\n// compose email\n$messenger-\u003ecreateMailMessage($recipients, $subject, $htmlMessage);\n\n// send the email and get the number of how many emails were sent\n$emailsSent = $messenger-\u003esend();\n\n```\n\n## Change mail transport type\n\nTo change the transport type you'll have to extend the createMailTransport method from Messenger class:\n\n```php\n\u003c?php\n\nuse Kisphp\\Mail\\Messenger;\n\nclass ProjectMessenger extends Messenger\n{\n    /**\n     * @return $this\n     */\n    protected function createMailTransport()\n    {\n        $this-\u003etransport = \\Swift_MailTransport::newInstance();\n        \n        return $this;\n    }\n}\n\nclass DemoMailerFactory extends AbstractMailerFactory\n{\n    \n    // createMailConfig method here\n    \n    /**\n     * @param MailConfigInterface $config\n     *\n     * @return MessengerInterface\n     */\n    public function createMessenger(MailConfigInterface $config)\n    {\n        return new ProjectMessenger($config);\n    }\n}\n\n// and load this class in your project\n$messenger = new ProjectMessenger($config);\n\n```\n\nMore details can be seen here: [SwiftMailer Sending](http://swiftmailer.org/docs/sending.html)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkisphp%2Fsimple-mail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkisphp%2Fsimple-mail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkisphp%2Fsimple-mail/lists"}