1. Go to this page and download the library: Download molnix/bounced-mail-manager 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/ */
// PostMail
use BounceMailHeaders;
public function __construct(Comment $comment)
{
$this->comment = $comment;
$this->setupBounceManager();
}
public function build(){
$this->subject('Comment added')
->markdown('emails.comment')
->addBounceManagerHeaders();
}
// PostMail
use BounceMailHeaders;
public function __construct(Comment $comment, $sender)
{
$this->comment = $comment;
$this->sender = $sender;
}
public function build(){
$this->subject('Comment added')
->markdown('emails.comment')
->addBounceManagerHeaders($this->sender);
}
- #### Create instance
use Molnix\BouncedMailManager\BounceManager;
use Molnix\BouncedMailManager\Clients\ImapClient;
$manager->setClient(new ImapClient(
'imap.example.com',
'993',
'[email protected]',
'emailpassword',
string $mailbox = 'INBOX',
array $options = [] // extra optional options
));
use Molnix\BouncedMailManager\BounceManager;
use Molnix\BouncedMailManager\Clients\O365Client;
$manager = new BounceManager();
$manager->setClient(new O365Client('[email protected]', $tenant_id, $client_id, $client_secret));
$manager->setMailbox('OtherMailbBoxName');
// Use -1 for all mails.
$manager->setDaysFrom(10); // Since last 10 days
$manager->enableDeleteMode(); // Since last 10 days
$manager->toArray(); // Returns simple array of bounces.
$manager->get(); // Returns array of bounces objects.
use Molnix\BouncedMailManager\BounceManager;
use Molnix\BouncedMailManager\Clients\O365;
$manager = new BounceManager();
$manager->setClient(new O365('[email protected]', $tenant_id, $client_id, $client_secret));
$manager->get();