### Install PHP mbstring module for Laravel IMAP Source: https://github.com/webklex/laravel-imap/blob/master/README.md This command installs the `mbstring` PHP module, which is a required dependency for the Laravel IMAP library. Ensure this module is enabled or installed on your system before proceeding with the library installation. ```bash sudo apt-get install php*-mbstring ``` -------------------------------- ### PHP Code Formatting Example for Issues Source: https://github.com/webklex/laravel-imap/blob/master/README.md This snippet demonstrates the correct markdown formatting for including PHP code within GitHub issues, ensuring it is displayed correctly and is easy to read for other contributors. ```php echo 'your php code...'; ``` -------------------------------- ### Install Laravel IMAP library via Composer Source: https://github.com/webklex/laravel-imap/blob/master/README.md This command uses Composer, the PHP dependency manager, to add the `webklex/laravel-imap` package to your Laravel project. This is the standard way to include the library in your application. ```bash composer require webklex/laravel-imap ``` -------------------------------- ### Basic Laravel IMAP email processing and moving example Source: https://github.com/webklex/laravel-imap/blob/master/README.md This PHP example demonstrates how to connect to an IMAP server, retrieve all mailboxes and messages, echo their subjects and HTML bodies, and then move each message to the 'INBOX.read' folder. This is a basic illustration of the library's capabilities and is not intended for production use without modifications. ```php /** @var \Webklex\PHPIMAP\Client $client */ $client = Webklex\IMAP\Facades\Client::account('default'); //Connect to the IMAP Server $client->connect(); //Get all Mailboxes /** @var \Webklex\PHPIMAP\Support\FolderCollection $folders */ $folders = $client->getFolders(); //Loop through every Mailbox /** @var \Webklex\PHPIMAP\Folder $folder */ foreach($folders as $folder){ //Get all Messages of the current Mailbox $folder /** @var \Webklex\PHPIMAP\Support\MessageCollection $messages */ $messages = $folder->messages()->all()->get(); /** @var \Webklex\PHPIMAP\Message $message */ foreach($messages as $message){ echo $message->getSubject().'
'; echo 'Attachments: '.$message->getAttachments()->count().'
'; echo $message->getHTMLBody(); //Move the current Message to 'INBOX.read' if($message->move('INBOX.read') == true){ echo 'Message has been moved'; }else{ echo 'Message could not be moved'; } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.