{"id":15700253,"url":"https://github.com/dcblogdev/imap","last_synced_at":"2025-05-12T13:11:25.174Z","repository":{"id":47873757,"uuid":"74881390","full_name":"dcblogdev/imap","owner":"dcblogdev","description":"IMAP class for reading imap emails with PHP","archived":false,"fork":false,"pushed_at":"2022-07-21T14:32:45.000Z","size":21,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T22:23:49.988Z","etag":null,"topics":["hacktoberfest","imap","php"],"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/dcblogdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["dcblogdev"]}},"created_at":"2016-11-27T10:41:01.000Z","updated_at":"2022-06-28T22:37:40.000Z","dependencies_parsed_at":"2022-08-21T10:20:26.429Z","dependency_job_id":null,"html_url":"https://github.com/dcblogdev/imap","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Fimap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Fimap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Fimap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcblogdev%2Fimap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcblogdev","download_url":"https://codeload.github.com/dcblogdev/imap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745169,"owners_count":21957318,"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":["hacktoberfest","imap","php"],"created_at":"2024-10-03T19:47:05.196Z","updated_at":"2025-05-12T13:11:25.126Z","avatar_url":"https://github.com/dcblogdev.png","language":"PHP","readme":"[![Latest Version on Packagist](https://img.shields.io/packagist/v/dcblogdev/imap.svg?style=flat-square)](https://packagist.org/packages/dcblogdev/imap)\n[![Total Downloads](https://img.shields.io/packagist/dt/dcblogdev/imap.svg?style=flat-square)](https://packagist.org/packages/dcblogdev/imap)\n\n![Logo](https://repository-images.githubusercontent.com/74881390/3b747080-49bf-11eb-9d44-c941e96ba0e7)\n\nIMAP class for reading IMAP emails with PHP\n\n# Example usage:\n\n```php\nuse Dcblogdev\\Imap\\Imap;\n\n//set search criteria\n$date = date('d-M-y', strtotime('1 week ago'));\n$term = 'ALL UNDELETED SINCE \"'.$date.'\"';\n\n//ignore array of emails\n$exclude = [];\n\n$email    = 'someone@domain.com';\n$password = 'emailpassword';\n$host     = 'outlook.office365.com';//your email host\n$port     = '993';//port number\n$savePath = \"emails\";//folder to save attachments\n$markAsSeen = true;//when true mark email as been read\n$delete   = false;//set to true to delete email\n\n//initialise email\n$imap = new Imap($email, $password, $host, $port, 'Inbox', $savePath, $markAsSeen, $delete);\n\n//get emails pass in the search term and exclude array\n$emails = $imap-\u003eemails($term, $exclude);\n\n//loop over emails and display\nforeach($emails as $email) {\n\t\n\techo \"Account {$email['account']}\u003cbr\u003e\";\n\techo \"Subject {$email['subject']}\u003cbr\u003e\";\n\techo \"From {$email['fromName']} ({$email['fromAddress']})\u003cbr\u003e\";\n\techo \"To {$email['toAddress']}\u003cbr\u003e\";\n\techo \"CC {$email['ccAddress']}\u003cbr\u003e\";\n\techo \"Date {$email['emailDate']}\u003cbr\u003e\";\n\techo count($email['attachments']).\" Attachments\u003cbr\u003e\";\n\n\tforeach($email['attachments'] as $attachment) {\n\t\techo \"\u003ca href='{$attachment['file']}'\u003e{$attachment['fileName']}\u003c/a\u003e\";\n\t}\n\n\techo \"\u003cbr\u003e\u003cbr\u003e\";\n\tif ($email['htmlBody'] !='') {\n\t\techo $email['htmlBody'];\n\t} else {\n\t\techo nl2br($email['plainBody']);\n\t}\n\techo \"\u003chr\u003e\";\n}\n```\n","funding_links":["https://github.com/sponsors/dcblogdev"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcblogdev%2Fimap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcblogdev%2Fimap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcblogdev%2Fimap/lists"}