PHP code example of danialpanah / mail-connect
1. Go to this page and download the library: Download danialpanah/mail-connect library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
danialpanah / mail-connect example snippets
DanialPanah\MailConnect\MailConnectServiceProvider::class
'MailConnect': DanialPanah\MailConnect\Facades\MailConnect::class
bash
php artisan vendor:publish --provider "DanialPanah\MailConnect\MailConnectServiceProvider"
bash
return [
'email_url' => env('MAIL_CONNECT_URL', null),
'email_username' => env('MAIL_CONNECT_USERNAME', null),
'email_password' => env('MAIL_CONNECT_PASSWORD', null)
];
array [
0 => array:3 [
"message_number" => 18
"header" => array [
"date" => "Wed, 14 Dec 2022 14:26:44 +0000"
"subject" => "Some Subject"
"message_id" => "<B92423C93DB34E729956B11C1FE1878E1D90FC80AD1C@JOBS.360-CONSULTING.DE>"
"toaddress" => "Danial Panah <[email protected] >"
"fromaddress" => "From Address <[email protected] >"
"reply_toaddress" => "Reply To Address <[email protected] >"
"senderaddress" => "Sender Address <[email protected] >"
"Recent" => ""
"Unseen" => ""
"Flagged" => ""
"Answered" => ""
"Deleted" => ""
"Draft" => ""
"Msgno" => " 18"
"MailDate" => "14-Dec-2022 14:48:16 +0000"
"Size" => "11566"
"udate" => "1671029296"
]
"body" => "Html Body Message"
]
1 => array:3 [▶]
2 => array:3 [▶]
3 => array:3 [▶]
4 => array:3 [▶]
5 => array:3 [▶]
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DanialPanah\MailConnect\MailConnect;
class MailboxController extends Controller
{
public function MyMailbox(): View
{
$messages = $mailConnect
->protocol('imap')
->directory('inbox')
->criteria('all')
->openMailbox();
return view('emails_inbox', ['messages' => $messages]);
}
}