{"id":21771131,"url":"https://github.com/initphp/mailer","last_synced_at":"2026-05-19T15:07:55.446Z","repository":{"id":56991539,"uuid":"470093025","full_name":"InitPHP/Mailer","owner":"InitPHP","description":"This is a simple and fast library for sending mail with PHP.","archived":false,"fork":false,"pushed_at":"2023-07-20T04:26:29.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T03:13:44.806Z","etag":null,"topics":["mailer","php-mail","php-mailer","php-mailer-smtp"],"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/InitPHP.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":"2022-03-15T09:43:10.000Z","updated_at":"2022-04-04T08:22:10.000Z","dependencies_parsed_at":"2022-08-21T12:20:47.109Z","dependency_job_id":null,"html_url":"https://github.com/InitPHP/Mailer","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/InitPHP%2FMailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FMailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FMailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FMailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InitPHP","download_url":"https://codeload.github.com/InitPHP/Mailer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244746790,"owners_count":20503264,"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":["mailer","php-mail","php-mailer","php-mailer-smtp"],"created_at":"2024-11-26T14:15:10.068Z","updated_at":"2026-05-19T15:07:50.405Z","avatar_url":"https://github.com/InitPHP.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mailer\n\nThis is a simple library for sending mail with SMTP consisting of a single class.\n\n\n[![Latest Stable Version](http://poser.pugx.org/initphp/mailer/v)](https://packagist.org/packages/initphp/mailer) [![Total Downloads](http://poser.pugx.org/initphp/mailer/downloads)](https://packagist.org/packages/initphp/mailer) [![Latest Unstable Version](http://poser.pugx.org/initphp/mailer/v/unstable)](https://packagist.org/packages/initphp/mailer) [![License](http://poser.pugx.org/initphp/mailer/license)](https://packagist.org/packages/initphp/mailer) [![PHP Version Require](http://poser.pugx.org/initphp/mailer/require/php)](https://packagist.org/packages/initphp/mailer)\n\n\n## Instalation\n\n```\ncomposer require initphp/mailer\n```\n\n## Requirements\n\n- PHP 7.4 or higher\n- MBString Extension\n- Iconv Extension\n- FileInfo Extension\n\n## Usage\n\n```php\n$config = [\n    'mailType'  =\u003e 'text' // or 'html'\n    'protocol'  =\u003e 'smtp' // or 'mail' or 'sendmail'\n    'SMTPAuth'  =\u003e true,\n    'SMTPHost'  =\u003e 'smtp.gmail.com',\n    'SMTPUser'  =\u003e 'your-mail@gmail.com',\n    'SMTPPass'  =\u003e 'YourMailPassword',\n    'SMTPPort'  =\u003e 587\n];\n$mailer = \\InitPHP\\Mailer\\Mailer::newInstance($config);\n\n$mailer-\u003esetFrom('info@muhammetsafak.com.tr', 'Muhammet Şafak');\n//$mailer-\u003esetTo('example@example.com');\n//$mailer-\u003esetCC('john@hotmail.com');\n//$mailer-\u003esetBCC('testing@gmail.com');\n$mailer-\u003esetSubject('Mail Subject');\n$mailer-\u003esetMessage('Mail Body Message');\n$mailer-\u003esend();\n```\n\n## Methods\n\n#### `newInstance()`\n\nCreates a new mailer object and returns it.\n\n```php\npublic static function newInstance(?array $config = null): \\InitPHP\\Mailer\\Mailer\n```\n\n### `clear()`\n\n```php\npublic function clear(bool $clearAttachments = false): self\n```\n\n### `setHeader()`\n\n```php\npublic function setHeader(string $header, string $value): self\n```\n\n### `setFrom()`\n\n```php\npublic function setFrom(string $from, string $name = '', ?string $returnPath = null): self\n```\n\n### `setReplyTo()`\n\n```php\npublic function setReplyTo(string $replyTo, string $name = ''): self\n```\n\n### `setTo()`\n\n```php\npublic function setTo(string|array $to): self\n```\n\n### `setCC()`\n\n```php\npublic function setCC(string $cc): self\n```\n\n### `setBCC()`\n\n```php\npublic function setBCC(string $bcc, ?int $limit = null): self\n```\n\n### `setSubject()`\n\n```php\npublic function setSubject(string $subject): self\n```\n\n### `setMessage()`\n\n```php\npublic function setMessage(string $body): self\n```\n\n### `setAttachmentCID()`\n\n```php\npublic function setAttachmentCID(string $fileName): false|string\n```\n\n### `setAltMessage()`\n\n```php\npublic function setAltMessage(string $str): self\n```\n\n### `setMailType()`\n\n```php\npublic function setMailType(string $type = 'text'): self\n```\n\n- `$type` : `text` or `html`\n\n### `setWordWrap()`\n\n```php\npublic function setWordWrap(bool $wordWrap = true): self\n```\n\n### `setProtocol()`\n\n```php\npublic function setProtocol(string $protocol = 'mail'): self\n```\n\n- `$protocol` : `mail`, `sendmail` or `smtp`\n\n### `setPriority()`\n\n```php\npublic function setPriority(int $n = 3): self\n```\n\n- `$n` : An integer between 1 and 5 inclusive.\n\n### `setNewline()`\n\n```php\npublic function setNewline(string $newLine = \\PHP_EOL): self\n```\n\n### `setCRLF()`\n\n```php\npublic function setCRLF(string $CRLF = \\PHP_EOL): self\n```\n\n### `attach()`\n\n```php\npublic function attach(string|resource $file, string $disposition = '', ?string $newName = null, ?string $mime = null): false|self\n```\n\n### `send()`\n\n```php\npublic function send(bool $autoClear = true): bool\n```\n\n### `printDebugger()`\n\n```php\npublic function printDebugger(array $include = ['headers', 'subject', 'body']): string\n```\n\n## Getting Help\n\nIf you have questions, concerns, bug reports, etc, please file an issue in this repository's Issue Tracker.\n\n## Getting Involved\n\n\u003e All contributions to this project will be published under the MIT License. By submitting a pull request or filing a bug, issue, or feature request, you are agreeing to comply with this waiver of copyright interest.\n\nThere are two primary ways to help:\n\n- Using the issue tracker, and\n- Changing the code-base.\n    \n### Using the issue tracker\n\nUse the issue tracker to suggest feature requests, report bugs, and ask questions. This is also a great way to connect with the developers of the project as well as others who are interested in this solution.\n\nUse the issue tracker to find ways to contribute. Find a bug or a feature, mention in the issue that you will take on that effort, then follow the Changing the code-base guidance below.\n\n### Changing the code-base\n\nGenerally speaking, you should fork this repository, make changes in your own fork, and then submit a pull request. All new code should have associated unit tests that validate implemented features and the presence or lack of defects. Additionally, the code should follow any stylistic and architectural guidelines prescribed by the project. In the absence of such guidelines, mimic the styles and patterns in the existing code-base.\n\n## Credits\n\n- [Muhammet ŞAFAK](https://www.muhammetsafak.com.tr) \u003c\u003cinfo@muhammetsafak.com.tr\u003e\u003e\n\n## License\n\nCopyright \u0026copy; 2022 [MIT License](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finitphp%2Fmailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finitphp%2Fmailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finitphp%2Fmailer/lists"}