{"id":28755586,"url":"https://github.com/theseer/imapstore","last_synced_at":"2025-08-17T01:32:28.118Z","repository":{"id":299386651,"uuid":"1002834668","full_name":"theseer/imapstore","owner":"theseer","description":"Minimalistic Imap Client to Store Messages on an IMAP Server","archived":false,"fork":false,"pushed_at":"2025-06-27T11:48:16.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-28T02:52:42.866Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theseer.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,"zenodo":null}},"created_at":"2025-06-16T08:07:34.000Z","updated_at":"2025-06-27T11:46:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"1b1b6310-42df-40bf-b50d-9f32a3c84aa5","html_url":"https://github.com/theseer/imapstore","commit_stats":null,"previous_names":["theseer/imapstore"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/theseer/imapstore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theseer%2Fimapstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theseer%2Fimapstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theseer%2Fimapstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theseer%2Fimapstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theseer","download_url":"https://codeload.github.com/theseer/imapstore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theseer%2Fimapstore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270796224,"owners_count":24647320,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2025-06-17T02:07:27.335Z","updated_at":"2025-08-17T01:32:28.108Z","avatar_url":"https://github.com/theseer.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ImapStore\n\nA minimalistic PHP IMAP client library specifically designed for storing email messages on IMAP servers. This library provides a clean, object-oriented interface for connecting to IMAP servers and storing messages with appropriate flags.\n\n## Features\n\n- **Lightweight**: Focused solely on storing messages, not retrieving them\n- **Secure**: Supports TLS/SSL connections\n- **Type-safe**: Built with strict PHP type declarations\n- **Simple API**: Easy-to-use object-oriented interface\n- **Flexible Authentication**: Currently supports LOGIN authentication with extensible architecture for custom authentication methods\n- **Message Flags**: Set message flags (like SEEN) when storing\n\n## Installation\n\nInstall via Composer:\n\n```bash\ncomposer require theseer/imapstore\n```\n\n## Requirements\n\n- PHP 8.4 or higher\n- No additional PHP extensions required\n\n## Usage\n\n### Basic Usage\n\n```php\n\u003c?php declare(strict_types=1);\n\nuse theseer\\imapstore\\Foldername;\nuse theseer\\imapstore\\ImapStore;\nuse theseer\\imapstore\\LoginAuthenticator;\nuse theseer\\imapstore\\Message;\nuse theseer\\imapstore\\MessageFlag;\nuse theseer\\imapstore\\TCPConnection;\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n// Create a complete email message\n$emailData = \"From: sender@example.com\\r\\n\";\n$emailData .= \"To: recipient@example.com\\r\\n\";\n$emailData .= \"Subject: Test Message\\r\\n\";\n$emailData .= \"Date: \" . date('r') . \"\\r\\n\";\n$emailData .= \"Content-Type: text/plain; charset=UTF-8\\r\\n\\r\\n\";\n$emailData .= \"This is the message body.\\r\\n\";\n\n// Create the IMAP store connection\n$store = new ImapStore(\n    TCPConnection::createTLS('imap.example.com'),\n    new LoginAuthenticator('username@example.com', 'password')\n);\n\n// Store the message in the INBOX folder with SEEN flag\n$store-\u003estore(\n    Message::fromString($emailData),\n    Foldername::fromString('INBOX'),\n    MessageFlag::SEEN\n);\n```\n\n### Advanced Usage\n\n#### Different Folder Destinations\n\n```php\n// Store in different folders\n$store-\u003estore(\n    Message::fromString($emailData),\n    Foldername::fromString('Sent'),\n    MessageFlag::SEEN\n);\n\n$store-\u003estore(\n    Message::fromString($emailData),\n    Foldername::fromString('Drafts'),\n    MessageFlag::DRAFT\n);\n```\n\n#### Non-TLS Connections\n\n```php\n// For non-TLS connections (not recommended for production)\n// Uses default port 143\n$store = new ImapStore(\n    TCPConnection::createPlain('imap.example.com'),\n    new LoginAuthenticator('username@example.com', 'password')\n);\n```\n\n#### Custom Ports and Connections\n\n```php\n// Using custom ports\n$store = new ImapStore(\n    TCPConnection::createTLS('imap.example.com', 1993),\n    new LoginAuthenticator('username@example.com', 'password')\n);\n\n// Custom connection implementations can be created if needed\n// by implementing the Connection interface\n```\n\n#### Custom Authentication\n\n```php\n// The library currently supports LOGIN authentication\n// Custom authentication methods can be implemented\n// by implementing the Authenticator interface\n\n$customAuth = new CustomAuthenticator($credentials);\n$store = new ImapStore(\n    TCPConnection::createTLS('imap.example.com'),\n    $customAuth\n);\n```\n\n#### Multiple Message Flags\n\n```php\n// Store message with multiple flags using variadics\n$store-\u003estore(\n    Message::fromString($emailData),\n    Foldername::fromString('INBOX'),\n    MessageFlag::SEEN,\n    MessageFlag::FLAGGED\n);\n```\n\n#### Using PHPMailer to Generate Messages\n\n```php\nuse PHPMailer\\PHPMailer\\PHPMailer;\n\n$mail = new PHPMailer();\n\n// ...\n\n$mail-\u003esetFrom('sender@example.com', 'John Doe');\n$mail-\u003eaddAddress('recipient@example.com', 'Jane Smith');\n$mail-\u003eSubject = 'Generated Email';\n$mail-\u003eBody = 'This email was generated using PHPMailer and stored via ImapStore.';\n\n// Potentially sent your mail using PHPMailer here \n\n// Store it using ImapStore\n$store-\u003estore(\n    Message::fromString($mail-\u003egetSentMIMEMessage()),\n    Foldername::fromString('Sent'),\n    MessageFlag::SEEN\n);\n```\n\n## Message Flags\n\nThe library supports the following message flags that can be set when storing messages:\n\n- `MessageFlag::SEEN` - Mark message as read\n- `MessageFlag::ANSWERED` - Mark message as answered  \n- `MessageFlag::FLAGGED` - Mark message as flagged/important\n- `MessageFlag::DELETED` - Mark message as deleted\n- `MessageFlag::DRAFT` - Mark message as draft\n\n\n## Error Handling\n\nThe library may throw exceptions for various error conditions. It's recommended to wrap your code in try-catch blocks:\n\n```php\ntry {\n    $store-\u003estore(\n        Message::fromString($emailData),\n        Foldername::fromString('INBOX'),\n        MessageFlag::SEEN\n    );\n    echo \"Message stored successfully\\n\";\n} catch (Exception $e) {\n    echo \"Error storing message: \" . $e-\u003egetMessage() . \"\\n\";\n}\n```\n\n## Security Considerations\n\n- Always use TLS/SSL connections when possible (`TCPConnection::createTLS()`)\n- Store credentials securely (consider using environment variables)\n- Use strong authentication methods\n\n## Alternatives and Complementary Libraries\n\n- **[DirectoryTree/ImapEngine](https://packagist.org/packages/directorytree/imapengine)** - Full-featured IMAP client when you need comprehensive email operations (reading, searching, managing)\n- **[ddeboer/imap](https://github.com/ddeboer/imap)** - Alternative full IMAP client library for reading and managing emails\n- **[PHPMailer](https://github.com/PHPMailer/PHPMailer)** - Ideal for generating properly formatted email messages that can then be stored using ImapStore\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheseer%2Fimapstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheseer%2Fimapstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheseer%2Fimapstore/lists"}