{"id":22281908,"url":"https://github.com/webklex/php-imap","last_synced_at":"2025-05-14T03:09:45.560Z","repository":{"id":32863545,"uuid":"144634423","full_name":"Webklex/php-imap","owner":"Webklex","description":"PHP-IMAP is a wrapper for common IMAP communication without the need to have the php-imap module installed / enabled. The protocol is completely integrated and therefore supports IMAP IDLE operation and the \"new\" oAuth authentication process as well.","archived":false,"fork":false,"pushed_at":"2025-05-07T16:27:13.000Z","size":923,"stargazers_count":376,"open_issues_count":102,"forks_count":171,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-07T17:28:21.605Z","etag":null,"topics":["imap","imap-client","imap-library","php","php-imap"],"latest_commit_sha":null,"homepage":"https://www.php-imap.com","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/Webklex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"ko_fi":"webklex","custom":["https://www.buymeacoffee.com/webklex"]}},"created_at":"2018-08-13T21:13:18.000Z","updated_at":"2025-05-07T16:27:17.000Z","dependencies_parsed_at":"2024-04-11T14:47:15.342Z","dependency_job_id":"b88eb74c-5d87-4db1-b541-9db4e20f3dd6","html_url":"https://github.com/Webklex/php-imap","commit_stats":{"total_commits":571,"total_committers":49,"mean_commits":"11.653061224489797","dds":"0.12259194395796846","last_synced_commit":"6d999438d29ed0bb920cd897b200a3a5fd6b6380"},"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Fphp-imap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Fphp-imap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Fphp-imap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Fphp-imap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Webklex","download_url":"https://codeload.github.com/Webklex/php-imap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254059511,"owners_count":22007769,"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":["imap","imap-client","imap-library","php","php-imap"],"created_at":"2024-12-03T16:23:27.528Z","updated_at":"2025-05-14T03:09:45.551Z","avatar_url":"https://github.com/Webklex.png","language":"PHP","funding_links":["https://ko-fi.com/webklex","https://www.buymeacoffee.com/webklex"],"categories":[],"sub_categories":[],"readme":"\n# IMAP Library for PHP\n\n[![Latest release on Packagist][ico-release]][link-packagist]\n[![Latest prerelease on Packagist][ico-prerelease]][link-packagist]\n[![Software License][ico-license]][link-license]\n[![Total Downloads][ico-downloads]][link-downloads]\n[![Hits][ico-hits]][link-hits]\n[![Discord][ico-discord]][link-discord]\n[![Snyk][ico-snyk]][link-snyk]\n\n\n## Description\nPHP-IMAP is a wrapper for common IMAP communication without the need to have the php-imap module installed / enabled.\nThe protocol is completely integrated and therefore supports IMAP IDLE operation and the \"new\" oAuth authentication\nprocess as well.\nYou can enable the `php-imap` module in order to handle edge cases, improve message decoding quality and is required if\nyou want to use legacy protocols such as pop3.\n\nOfficial documentation: [php-imap.com](https://www.php-imap.com/)\n\nLaravel wrapper: [webklex/laravel-imap](https://github.com/Webklex/laravel-imap)\n\nDiscord: [discord.gg/rd4cN9h6][link-discord]\n\n## Table of Contents\n- [Documentations](#documentations)\n- [Compatibility](#compatibility)\n- [Basic usage example](#basic-usage-example)\n- [Sponsors](#sponsors)\n- [Testing](#testing)\n- [Known issues](#known-issues)\n- [Support](#support)\n- [Features \u0026 pull requests](#features--pull-requests)\n- [Alternatives \u0026 Different Flavors](#alternatives--different-flavors)\n- [Security](#security)\n- [Credits](#credits)\n- [License](#license)\n\n\n## Documentations\n- Legacy (\u003c v2.0.0): [legacy documentation](https://github.com/Webklex/php-imap/tree/1.4.5)\n- Core documentation: [php-imap.com](https://www.php-imap.com/)\n\n\n## Compatibility\n| Version | PHP 5.6 | PHP 7 | PHP 8 |\n|:--------|:-------:|:-----:|:-----:|\n| v6.x    |    /    |   /   |   X   |\n| v5.x    |    /    |   /   |   X   |\n| v4.x    |    /    |   X   |   X   |\n| v3.x    |    /    |   X   |   /   |\n| v2.x    |    X    |   X   |   /   |\n| v1.x    |    X    |   /   |   /   |\n\n## Basic usage example\nThis is a basic example, which will echo out all Mails within all imap folders\nand will move every message into INBOX.read. Please be aware that this should not be\ntested in real life and is only meant to give an impression on how things work.\n\n```php\nuse Webklex\\PHPIMAP\\ClientManager;\n\nrequire_once \"vendor/autoload.php\";\n\n$cm = new ClientManager('path/to/config/imap.php');\n\n/** @var \\Webklex\\PHPIMAP\\Client $client */\n$client = $cm-\u003eaccount('account_identifier');\n\n//Connect to the IMAP Server\n$client-\u003econnect();\n\n//Get all Mailboxes\n/** @var \\Webklex\\PHPIMAP\\Support\\FolderCollection $folders */\n$folders = $client-\u003egetFolders();\n\n//Loop through every Mailbox\n/** @var \\Webklex\\PHPIMAP\\Folder $folder */\nforeach($folders as $folder){\n\n    //Get all Messages of the current Mailbox $folder\n    /** @var \\Webklex\\PHPIMAP\\Support\\MessageCollection $messages */\n    $messages = $folder-\u003emessages()-\u003eall()-\u003eget();\n    \n    /** @var \\Webklex\\PHPIMAP\\Message $message */\n    foreach($messages as $message){\n        echo $message-\u003egetSubject().'\u003cbr /\u003e';\n        echo 'Attachments: '.$message-\u003egetAttachments()-\u003ecount().'\u003cbr /\u003e';\n        echo $message-\u003egetHTMLBody();\n        \n        //Move the current Message to 'INBOX.read'\n        if($message-\u003emove('INBOX.read') == true){\n            echo 'Message has been moved';\n        }else{\n            echo 'Message could not be moved';\n        }\n    }\n}\n```\n\n## Sponsors\n[![elb-BIT][ico-sponsor-elb-bit]][link-sponsor-elb-bit]\n[![Feline][ico-sponsor-feline]][link-sponsor-feline]\n\n\n## Testing\nTo run the tests, please execute the following command:\n```bash\ncomposer test\n```\n\n### Quick-Test / Static Test\nTo disable all test which require a live mailbox, please copy the `phpunit.xml.dist` to `phpunit.xml` and adjust the configuration:\n```xml\n\u003cphp\u003e\n    \u003cenv name=\"LIVE_MAILBOX\" value=\"false\"/\u003e\n\u003c/php\u003e\n```\n\n### Full-Test / Live Mailbox Test\nTo run all tests, you need to provide a valid imap configuration.\n\nTo provide a valid imap configuration, please copy the `phpunit.xml.dist` to `phpunit.xml` and adjust the configuration:\n```xml\n\u003cphp\u003e\n    \u003cenv name=\"LIVE_MAILBOX\" value=\"true\"/\u003e\n    \u003cenv name=\"LIVE_MAILBOX_DEBUG\" value=\"true\"/\u003e\n    \u003cenv name=\"LIVE_MAILBOX_HOST\" value=\"mail.example.local\"/\u003e\n    \u003cenv name=\"LIVE_MAILBOX_PORT\" value=\"993\"/\u003e\n    \u003cenv name=\"LIVE_MAILBOX_VALIDATE_CERT\" value=\"false\"/\u003e\n    \u003cenv name=\"LIVE_MAILBOX_QUOTA_SUPPORT\" value=\"true\"/\u003e\n    \u003cenv name=\"LIVE_MAILBOX_ENCRYPTION\" value=\"ssl\"/\u003e\n    \u003cenv name=\"LIVE_MAILBOX_USERNAME\" value=\"root@example.local\"/\u003e\n    \u003cenv name=\"LIVE_MAILBOX_PASSWORD\" value=\"foobar\"/\u003e\n\u003c/php\u003e\n```\n\nThe test account should **not** contain any important data, as it will be deleted during the test.\nFurthermore, the test account should be able to create new folders, move messages and should **not** be used by any other\napplication during the test.\n\nIt's recommended to use a dedicated test account for this purpose. You can use the provided `Dockerfile` to create an imap server used for testing purposes.\n\nBuild the docker image:\n```bash\ncd .github/docker\n\ndocker build -t php-imap-server .\n```\nRun the docker image:\n```bash\ndocker run --name imap-server -p 993:993 --rm -d php-imap-server\n```\nStop the docker image:\n```bash\ndocker stop imap-server\n```\n\n\n### Known issues\n| Error                                                                      | Solution                                                                                |\n|:---------------------------------------------------------------------------|:----------------------------------------------------------------------------------------|\n| Kerberos error: No credentials cache file found (try running kinit) (...)  | Uncomment \"DISABLE_AUTHENTICATOR\" inside your config and use the `legacy-imap` protocol |\n\n\n## Support\nIf you encounter any problems or if you find a bug, please don't hesitate to create a new [issue](https://github.com/Webklex/php-imap/issues).\nHowever, please be aware that it might take some time to get an answer.\nOff-topic, rude or abusive issues will be deleted without any notice.\n\nIf you need **commercial** support, feel free to send me a mail at github@webklex.com.\n\n\n##### A little notice\nIf you write source code in your issue, please consider to format it correctly. This makes it so much nicer to read  \nand people are more likely to comment and help :)\n\n\u0026#96;\u0026#96;\u0026#96;php\n\necho 'your php code...';\n\n\u0026#96;\u0026#96;\u0026#96;\n\nwill turn into:\n```php \necho 'your php code...'; \n``` \n\n\n## Features \u0026 pull requests\nEveryone can contribute to this project. Every pull request will be considered, but it can also happen to be declined.  \nTo prevent unnecessary work, please consider to create a [feature issue](https://github.com/Webklex/php-imap/issues/new?template=feature_request.md)  \nfirst, if you're planning to do bigger changes. Of course, you can also create a new [feature issue](https://github.com/Webklex/php-imap/issues/new?template=feature_request.md)\nif you're just wishing a feature ;)\n\n\n## Alternatives \u0026 Different Flavors\nThis library and especially the code flavor It's written in, is certainly not for everyone. If you are looking for a \ndifferent approach, you might want to check out the following libraries:\n- [ddeboer/imap](https://github.com/ddeboer/imap)\n- [barbushin/php-imap](https://github.com/barbushin/php-imap)\n- [DirectoryTree/ImapEngine](https://github.com/DirectoryTree/ImapEngine)\n\n\n## Change log\nPlease see [CHANGELOG][link-changelog] for more information what has changed recently.\n\n\n## Security\nIf you discover any security related issues, please email github@webklex.com instead of using the issue tracker.\n\n\n## Credits\n- [Webklex][link-author]\n- [All Contributors][link-contributors]\n\n\n## License\nThe MIT License (MIT). Please see [License File][link-license] for more information.\n\n\n[ico-release]: https://img.shields.io/packagist/v/Webklex/php-imap.svg?style=flat-square\u0026label=version\n[ico-prerelease]: https://img.shields.io/github/v/release/webklex/php-imap?include_prereleases\u0026style=flat-square\u0026label=pre-release\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/Webklex/php-imap.svg?style=flat-square\n[ico-hits]: https://hits.webklex.com/svg/webklex/php-imap\n[ico-snyk]: https://snyk-widget.herokuapp.com/badge/composer/webklex/php-imap/badge.svg\n[ico-discord]: https://img.shields.io/static/v1?label=discord\u0026message=open\u0026color=5865f2\u0026style=flat-square\n\n[link-packagist]: https://packagist.org/packages/Webklex/php-imap\n[link-downloads]: https://packagist.org/packages/Webklex/php-imap\n[link-author]: https://github.com/webklex\n[link-contributors]: https://github.com/Webklex/php-imap/graphs/contributors\n[link-license]: https://github.com/Webklex/php-imap/blob/master/LICENSE\n[link-changelog]: https://github.com/Webklex/php-imap/blob/master/CHANGELOG.md\n[link-hits]: https://hits.webklex.com\n[link-snyk]: https://snyk.io/vuln/composer:webklex%2Fphp-imap\n[link-discord]: https://discord.gg/vUHrbfbDr9\n\n\n[ico-sponsor-feline]: https://cdn.feline.dk/public/feline.png\n[link-sponsor-feline]: https://www.feline.dk\n[ico-sponsor-elb-bit]: https://www.elb-bit.de/user/themes/deliver/images/logo_small.png\n[link-sponsor-elb-bit]: https://www.elb-bit.de?ref=webklex/php-imap","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebklex%2Fphp-imap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebklex%2Fphp-imap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebklex%2Fphp-imap/lists"}