2017 © Pedro Peláez
 

library single-recipient-mailer

Mailer which sends all the emails to one address. Usable for testing purpose.

image

adt/single-recipient-mailer

Mailer which sends all the emails to one address. Usable for testing purpose.

  • Thursday, April 5, 2018
  • by michallohnisky
  • Repository
  • 14 Watchers
  • 0 Stars
  • 1,881 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 30 % Grown

The README.md

Single Recipient

Component modifies Nette\Mail\Message to send all the emails to one address. Suitable for non production environments., (*1)

Original To, Cc and Bcc email addresses are stored in the subject of the email (for example: To: origTo@example.com; origTo2@example.com; Cc: origCc@example.com | My email subject)., (*2)

Installation

$ composer require adt/single-recipient-mailer

Usage

via trait

Use ADT\SingleRecipient\SingleRecipient trait in your mailer and then use applySingleRecipient method to apply a single recipient logic to an original message., (*3)

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, 'developers@myproject.com');
        }

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

via config

Register ADT\SingleRecipient\SingleRecipientMailer in your config.neon to use @sendmailMailer and redirect all emails to developers@myProject.com:, (*4)

services:
    sendmailMailer:
        class: Nette\Mail\SendmailMailer
        autowired: no # this is important

    mail.mailer: \ADT\SingleRecipient\SingleRecipientMailer(@sendmailMailer, 'developers@myproject.com')

The autowired: no option is important because Nette DI container would not know which \Nette\Mail\IMailer to inject in your application., (*5)

via inheritance

You can also extend the class if you want to:, (*6)

namespace App\Model;

use Nette\Mail\SendmailMailer;

class Mailer extends \ADT\SingleRecipient\SingleRecipientMailer 
{
    public function __construct() 
    {
        parent::__construct(new SendMailMailer, 'developers@myproject.com');
    }

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

You can disable redirecting to single recipient by passing empty value (e.g. NULL or zero-length string)., (*7)

The Versions

05/04 2018

dev-master

9999999-dev http://appsdevteam.com

Mailer which sends all the emails to one address. Usable for testing purpose.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

05/04 2018

v3.2

3.2.0.0 http://appsdevteam.com

Mailer which sends all the emails to one address. Usable for testing purpose.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

25/03 2018

v3.1

3.1.0.0 http://appsdevteam.com

Mailer which sends all the emails to one address. Usable for testing purpose.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

19/02 2018

v3.0

3.0.0.0 http://appsdevteam.com

Mailer which sends all the emails to one address. Usable for testing purpose.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

25/07 2017

v2.0

2.0.0.0 http://appsdevteam.com

Mailer which sends all the emails to one address. Usable for testing purpose.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

28/04 2016

v1.0.2

1.0.2.0 http://appsdevteam.com

Mailer which sends all the emails to one address. Usable for testing purpose.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

18/04 2016

1.0.1

1.0.1.0 http://appsdevteam.com

Mailer which sends all the emails to one address. Usable for testing purpose.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

01/09 2015

v1.0

1.0.0.0 http://appsdevteam.com

Mailer which sends all the emails to one address. Usable for testing purpose.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires