Redaxscript\Mailer::init PHP Method

init() public method

init the class
Since: 2.4.0
public init ( array $toArray = [], array $fromArray = [], string $subject = null, mixed $body = null, array $attachmentArray = [] )
$toArray array array of recipient
$fromArray array array of sender
$subject string subject of the email
$body mixed body of the email
$attachmentArray array array of attachments
    public function init($toArray = [], $fromArray = [], $subject = null, $body = null, $attachmentArray = [])
    {
        $this->_toArray = $toArray;
        $this->_fromArray = $fromArray;
        $this->_subject = $subject;
        $this->_body = $body;
        $this->_attachmentArray = $attachmentArray;
        /* create as needed */
        $this->_createFromString();
        $this->_createSubjectString();
        $this->_createBodyString();
        $this->_createHeaderString();
    }

Usage Example

Example #1
0
 /**
  * testMessage
  *
  * @since 2.2.0
  *
  * @param array $toArray
  * @param array $fromArray
  * @param string $subject
  * @param mixed $body
  * @param array $attachmentArray
  *
  * @dataProvider providerMailer
  */
 public function testMessage($toArray = [], $fromArray = [], $subject = null, $body = null, $attachmentArray = [])
 {
     /* setup */
     $mailer = new Mailer();
     $mailer->init($toArray, $fromArray, $subject, $body, $attachmentArray);
     /*compare */
     $this->assertTrue(is_bool($mailer->send()));
 }
All Usage Examples Of Redaxscript\Mailer::init