PHP code example of adt / single-recipient-mailer

1. Go to this page and download the library: Download adt/single-recipient-mailer 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/ */

    

adt / single-recipient-mailer example snippets


namespace App\Model;

use ADT\SingleRecipient\SingleRecipient;
use \Nette\Mail\SendmailMailer;

class Mailer extends SendmailMailer
{
	use SingleRecipient;

	public function send(Message $mail): void
	{
		if ($this->singleRecipient) {
			$this->applySingleRecipient($mail, '[email protected]');
		}

		$this->send($mail);
	}
}

namespace App\Model;

use Nette\Mail\SendmailMailer;

class Mailer extends \ADT\SingleRecipient\SingleRecipientMailer 
{
	public function __construct() 
	{
		parent::__construct(new SendMailMailer, '[email protected]');
	}

	public function send(\Nette\Mail\Message $mail) 
	{
		parent::send($mail); # do not forget to call this
	}
}