{"id":18243756,"url":"https://github.com/syu6noob/myail","last_synced_at":"2026-01-27T11:02:13.782Z","repository":{"id":260728140,"uuid":"882183143","full_name":"syu6noob/myail","owner":"syu6noob","description":"A Simple Email Client for PHP","archived":false,"fork":false,"pushed_at":"2024-11-02T05:38:48.000Z","size":48,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T07:43:11.166Z","etag":null,"topics":["e-mail","email","php","php-lib","php-library","pop3"],"latest_commit_sha":null,"homepage":"","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/syu6noob.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-02T05:11:59.000Z","updated_at":"2025-01-29T03:37:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"97bae729-d37a-442c-80c7-14a480a05f7b","html_url":"https://github.com/syu6noob/myail","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"dd697c85ba183fd053ecc0b7efa513e8ba475290"},"previous_names":["syu6noob/myail"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/syu6noob/myail","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syu6noob%2Fmyail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syu6noob%2Fmyail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syu6noob%2Fmyail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syu6noob%2Fmyail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syu6noob","download_url":"https://codeload.github.com/syu6noob/myail/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syu6noob%2Fmyail/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28812367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T07:41:26.337Z","status":"ssl_error","status_checked_at":"2026-01-27T07:41:08.776Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["e-mail","email","php","php-lib","php-library","pop3"],"created_at":"2024-11-05T09:02:58.870Z","updated_at":"2026-01-27T11:02:13.767Z","avatar_url":"https://github.com/syu6noob.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\r\n  \r\n\u003ch1\u003e\r\n  \u003cimg width=\"40%\" src=\"/resources/myail_logo_text.svg\" /\u003e\r\n\u003c/h1\u003e\r\n  \r\n\u003cp\u003e🐱 A Simple Email Client for PHP\u003c/p\u003e\r\n  \r\n💡 [What is Myail?](#-what-is-myail) •\r\n ✨ [Feature](#-feature) •\r\n ⚡ [Requirement](#-requirement) •\r\n 🛠️ [Contribution](#%EF%B8%8F-contribution) •\r\n 💬 [Feedback](#-feedback) •\r\n 📄 [LICENSE](#-license)\r\n\r\n\u003c/div\u003e\r\n\r\n## 💡 What is Myail?\r\n\r\nMyail is a lightweight email client for PHP 7.0 and above.  \r\nThis library provides methods that can be easily integrated into your projects. Myail doesn’t use the IMAP extension, making it slightly faster.  \r\nThe name \"Myail\" is inspired by a cat sound in Japanese \"Mya~\".  \r\n\r\n## ✨ Feature\r\n\r\n- **POP3 Server Support** - Connect to POP3 servers compliant with RFC 1939, RFC 2449, RFC 2045, and RFC 2047.\r\n- **SSL Connection** - Supports both plaintext and SSL connections. You can also configure [SSL context options](https://www.php.net/manual/en/context.ssl.php) for various SSL connection types.\r\n- **Mail Header Parser** - Format email headers automatically.\r\n- **Mail Saving** - Save entire emails or just the body to a local directory. \r\n\r\n### 💫 Upcoming Features\r\n\r\n- **SMTP Server Support**\r\n- **IMAP Server Support**\r\n- And more!  \r\n\r\nIf you'd like to help develop these features, contributions are welcome!\r\n\r\n## ⚡ Requirement\r\n- PHP \u003e= 7.0\r\n- ext-mbstring\r\n\r\n## 🚀 Usage\r\nFor a complete example, please refer to [example.php](./resources/example.php).\r\n\r\n### Installation\r\n\r\nTo install using Composer, run the following command:\r\n```bash\r\n$ composer require syu6noob/myail\r\n```\r\n\r\n### Initialization\r\n\r\nIn a PHP file (e.g., `index.php`) in the directory containing the `src/` folder, add the following code:\r\n\r\n```php\r\n\u003c?php\r\n\r\nrequire_once __DIR__ . '/vendor/autoload.php';\r\n\r\nuse Myail\\POP3;\r\n\r\ntry {\r\n    $pop3 = new POP3([\r\n        'hostname' =\u003e 'pop.example.com',\r\n        'port' =\u003e 110, // use 995 for SSL\r\n        'is_ssl' =\u003e false, // set to true for SSL\r\n        'timeout' =\u003e 10, // optional\r\n        'auth' =\u003e [\r\n            'username' =\u003e 'username',\r\n            'password' =\u003e 'password',\r\n            `methods` =\u003e ['user', 'sasl_login', 'sasl_plain'] // optional\r\n        ],\r\n        'stream_options' =\u003e [\r\n            // optional\r\n            'ssl' =\u003e [\r\n                'cafile' =\u003e __DIR__ . '/cacert.pem',\r\n                'verify_peer' =\u003e false,\r\n                'verify_peer_name' =\u003e false,\r\n            ]\r\n        ],\r\n        'mail_save_directory' =\u003e __DIR__ . '/save/'\r\n    ]);\r\n    \r\n    // Additional code here...\r\n    \r\n} catch (\\Exception $ex) {\r\n    echo $ex-\u003egetMessage();\r\n}\r\n```\r\n#### Parameters\r\n`*` is required parameter.\r\n- `hostname`* - POP3 server hostname\r\n- `port`* - POP3 server port number\r\n- `is_ssl`* - Whether the connection uses SSL\r\n- `auth` - Authorization options\r\n  - `username`* - POP3 server username\r\n  - `password`* - POP3 server password\r\n  - `methods` - The order in which to execute authentication methods\r\n- `timeout` -  Connection timeout in seconds\r\n- `stream_options` - [SSL context options](https://www.php.net/manual/en/context.ssl.php) for secure connections.\r\n- `mail_save_directory`* - Directory to save downloaded emails\r\n\r\n----\r\n\r\n### quit()\r\n\r\n`quit()`\r\n\r\nCloses the connection to the POP3 server and applies any pending deletions.\r\n\r\n#### Example\r\n```php\r\n$pop3-\u003equit();\r\n```\r\n\r\n----\r\n\r\n### getStatus()\r\n\r\n`getStatus(): array`  \r\n\r\nRetrieve the total number of emails and total size on the server: \r\n\r\n#### Example\r\n```php\r\n$pop3-\u003egetStatus();\r\n```\r\n#### Returns\r\n```php\r\narray(2) [\r\n    'count' =\u003e nn, # total number of emails\r\n    'size'  =\u003e mm  # total size of all emails\r\n]\r\n```\r\n\r\n----\r\n\r\n### getMailSize()\r\n\r\n`getMailSize(int $message_number): int`  \r\n\r\nRetrieves the size of the specified email.\r\n\r\n#### Example\r\n```php\r\n$pop3-\u003egetMailSize(10);\r\n```\r\n#### Returns\r\n```php\r\nXXXX # mail size\r\n```\r\n\r\n----\r\n\r\n### getMailSizeList()\r\n\r\n`getMailSizeList(int $max_count = 50): array`\r\n\r\nRetrieves the size of the specified number of emails.\r\n\r\nIf `$max_count = -1`, the library retrieves the size of all emails on the server.\r\n\r\n#### Example\r\n```php\r\n$pop3-\u003egetMailSizeList(-1);\r\n```\r\n#### Returns\r\n```php\r\narray(XX) [\r\n    1 =\u003e XXXX,\r\n    2 =\u003e XXXX,\r\n    3 =\u003e XXXX,\r\n    ...\r\n]\r\n```\r\n\r\n----\r\n\r\n### getMailUid()\r\n\r\n`getMailUid(int $message_number): string`\r\n\r\nRetrieves the uid (unique-id) of the specified email.\r\n\r\n#### Example\r\n```php\r\n$pop3-\u003egetMailUid(10);\r\n```\r\n#### Returns\r\n```php\r\nXXXXXXXXXX # mail uid\r\n```\r\n\r\n----\r\n\r\n### getMailUidList()\r\n\r\n`getMailUidList(int $max_count = 50): array`\r\n\r\nRetrieves the uid lists of the specified number of emails.\r\n\r\nIf `$max_count = -1`, the library retrieves the uid lists of all emails on the server.\r\n\r\n\r\n#### Example\r\n```php\r\n$pop3-\u003egetMailUidlList(-1);\r\n```\r\n#### Returns\r\n```php\r\narray(XX) [\r\n    1 =\u003e XXXX,\r\n    2 =\u003e XXXX,\r\n    3 =\u003e XXXX,\r\n    ...\r\n]\r\n```\r\n\r\n----\r\n\r\n### deleteMail()\r\n\r\n`deleteMail(int $message_number)`\r\n\r\nDelete the specified email.\r\n\r\n\u003e [!NOTE]  \r\n\u003e This action marks the specified email for deletion.\r\n\u003e The email is actually deleted only when the connection is closed by calling quit().\r\n\r\n#### Example\r\n```php\r\n$pop3-\u003edeleteMail(10);\r\n```\r\n\r\n----\r\n\r\n### getMailHeader()\r\n\r\n#### Example\r\n`getMailHeaderRaw(int $message_number): string`\r\n\r\nFetch the header of specified email which is split into field name and value\r\n\r\n#### Example\r\n```php\r\n$pop3-\u003egetMailHeaderRaw(1);\r\n```\r\n#### Return\r\n```\r\narray [\r\n  'from' =\u003e 'John Doe \u003cjdoe@machine.example\u003e',\r\n  'to' =\u003e 'Mary Smith \u003cmary@example.net\u003e',\r\n  'subject' =\u003e 'Saying Hello',\r\n  'date' =\u003e 'Fri, 21 Nov 1997 09:55:06 -0600',\r\n  'message-id' =\u003e '\u003c1234@local.machine.example\u003e'\r\n]\r\n```\r\n\r\n----\r\n\r\n### getMailHeaderParsed()\r\n\r\n`getMailHeaderParsed(int $message_number): array`\r\n\r\nFetch the formated header of specified email.  \r\nThis includes fields such as:\r\n- `To:`\r\n- `Cc:`\r\n- `Bcc:`\r\n- `From:`\r\n- `Sender:`\r\n- `Subject:`\r\n- `Data:`\r\n- `Message-id:`\r\n- `References:`\r\n- `In-reply-to:`\r\n- `Mime-version:`\r\n- `Content-type:`\r\n- `Content-transfer-encoding:`\r\n\r\n#### Example\r\n```php\r\n$pop3-\u003egetMailHeaderParsed(2);\r\n```\r\n#### Returns\r\n```php\r\n# From: John Doe \u003cjdoe@machine.example\u003e\r\n# To: Mary Smith \u003cmary@example.net\u003e\r\n# Cc: A Group:Ed Jones \u003cc@a.test\u003e,joe@where.test,John \u003cjdoe@one.test\u003e;\r\n# Bcc: Hidden recipients  :(nobody(that I know))  ;\r\n# Subject: Saying Hello\r\n# Date: Fri, 21 Nov 1997 09:55:06 -0600\r\n# Message-ID: \u003c1234@local.machine.example\u003e\r\n\r\narray [\r\n    'from' =\u003e [\r\n        0 =\u003e [\r\n            'display_name' =\u003e 'John Doe',\r\n            'address' =\u003e 'admin@onamae.com'\r\n        ]\r\n    ],\r\n    'to' =\u003e [\r\n        0 =\u003e [\r\n            'display_name' =\u003e 'Mary Smith',\r\n            'address' =\u003e 'mary@example.net'\r\n        ]\r\n    ],\r\n    'cc' =\u003e [\r\n        'mailboxes' =\u003e [\r\n            [\r\n                'display_name' =\u003e 'Ed Jones',\r\n                'address' =\u003e \"c@a.test\"\r\n            ],\r\n            [\r\n                'address' =\u003e 'joe@where.test'\r\n            ],\r\n            [\r\n                'display_name' =\u003e 'John',\r\n                'address' =\u003e 'jdoe@one.test'\r\n            ],\r\n        ],\r\n        'group_name' =\u003e 'A Group'\r\n    ],\r\n    'bcc' =\u003e [\r\n        'mailboxes' =\u003e [],\r\n        'group_name' =\u003e 'Hidden recipients'\r\n    ],\r\n    'subject' =\u003e 'Saying Hello',\r\n    'date' =\u003e 'Fri, 21 Nov 1997 09:55:06 -0600',\r\n    'message-id' =\u003e '\u003c1234@local.machine.example\u003e'\r\n]\r\n```\r\n\r\n----\r\n\r\n### getMailBodyRaw()\r\n\r\n`getMailBodyRaw(int $message_number): string`\r\n\r\nFetch the raw body of specified email.\r\n\r\n#### Example\r\n```php\r\n$pop3-\u003egetMailBodyRaw(1);\r\n```\r\n#### Returns\r\n```\r\nThis is a message just to say hello.\r\nSo, \"Hello\".\r\n```\r\n\r\n----\r\n\r\n### getMailRaw()\r\n\r\n`getMailRaw(int $message_number): string`\r\n\r\nFetch the entire contents of specified email, including both headers and body.\r\n\r\n#### Example\r\n```php\r\n$pop3-\u003egetMailRaw(1);\r\n```\r\n#### Return\r\n```\r\nFrom: John Doe \u003cjdoe@machine.example\u003e\r\nTo: Mary Smith \u003cmary@example.net\u003e\r\nSubject: Saying Hello\r\nDate: Fri, 21 Nov 1997 09:55:06 -0600\r\nMessage-ID: \u003c1234@local.machine.example\u003e\r\n\r\nThis is a message just to say hello.\r\nSo, \"Hello\".\r\n```\r\n\r\n----\r\n\r\n### getMailHeaderRaw()\r\n\r\n#### Example\r\n`getMailHeaderRaw(int $message_number): string`\r\n\r\nFetch the raw header of specified email.\r\n\r\n#### Example\r\n```php\r\n$pop3-\u003egetMailHeaderRaw(1);\r\n```\r\n#### Return\r\n```\r\nFrom: John Doe \u003cjdoe@machine.example\u003e\r\nTo: Mary Smith \u003cmary@example.net\u003e\r\nSubject: Saying Hello\r\nDate: Fri, 21 Nov 1997 09:55:06 -0600\r\nMessage-ID: \u003c1234@local.machine.example\u003e\r\n```\r\n\r\n----\r\n\r\n### getMailBodyRaw()\r\n\r\n#### Example\r\n`getMailBodyRaw(int $message_number): string`\r\n\r\nFetch the raw body of specified email.\r\n\r\n#### Example\r\n```php\r\n$pop3-\u003egetMailBodyRaw(1);\r\n```\r\n#### Return\r\n```\r\nThis is a message just to say hello.\r\nSo, \"Hello\".\r\n```\r\n\r\n## 🛠️ Contribution\r\n\r\n**Myail is currently in beta.**  \r\nSome features are still under development. If you’re interested in helping develop new features or improving existing ones, please feel free to open issues or submit pull requests.    \r\n\r\n## 💬 Feedback\r\n\r\nThe author is new to open-source projects, PHP, and welcomes any feedback or suggestions.  \r\nI would like you to share your thoughts by creating issues or pull requests.\r\nYou can also contact the author on [X](https://www.x.com/syu6noob/).\r\n\r\n## 📄 LICENSE\r\n\r\nThis library is licensed under Apache License 2.0.  \r\nIf you include Myail in your own project, I would be happy to know about it!\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyu6noob%2Fmyail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyu6noob%2Fmyail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyu6noob%2Fmyail/lists"}