init() public méthode

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
 /**
  * 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()));
 }
 /**
  * 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 = array(), $fromArray = array(), $subject = null, $body = null, $attachmentArray = array())
 {
     /* setup */
     $mailer = new Mailer();
     $mailer->init($toArray, $fromArray, $subject, $body, $attachmentArray);
     /* actual */
     $mailer->send();
     /*compare */
     $this->assertTrue(true);
 }
Exemple #3
0
 /**
  * send the mail
  *
  * @since 3.0.0
  *
  * @param array $mailArray
  *
  * @return boolean
  */
 protected function _mail($mailArray = [])
 {
     $urlLogin = $this->_registry->get('root') . '/' . $this->_registry->get('parameterRoute') . 'login';
     /* html elements */
     $linkElement = new Html\Element();
     $linkElement->init('a', ['href' => $urlLogin])->text($urlLogin);
     /* prepare mail */
     $toArray = [$mailArray['name'] => $mailArray['email'], Db::getSetting('author') => Db::getSetting('notification') ? Db::getSetting('email') : null];
     $fromArray = [$mailArray['name'] => $mailArray['email']];
     $subject = $this->_language->get('registration');
     $bodyArray = ['<strong>' . $this->_language->get('name') . $this->_language->get('colon') . '</strong> ' . $mailArray['name'], '<br />', '<strong>' . $this->_language->get('user') . $this->_language->get('colon') . '</strong> ' . $mailArray['user'], '<br />', '<strong>' . $this->_language->get('password') . $this->_language->get('colon') . '</strong> ' . $mailArray['password'], '<br />', '<strong>' . $this->_language->get('login') . $this->_language->get('colon') . '<strong> ' . $linkElement];
     /* send mail */
     $mailer = new Mailer();
     $mailer->init($toArray, $fromArray, $subject, $bodyArray);
     return $mailer->send();
 }
Exemple #4
0
 /**
  * send the mail
  *
  * @since 3.0.0
  *
  * @param array $mailArray
  *
  * @return boolean
  */
 protected function _mail($mailArray = [])
 {
     /* html elements */
     $linkElement = new Html\Element();
     $linkElement->init('a', ['href' => $this->_registry->get('root')])->text($this->_registry->get('root'));
     /* prepare mail */
     $toArray = [$mailArray['adminName'] => $mailArray['adminEmail']];
     $fromArray = [Db::getSetting('author') => Db::getSetting('email')];
     $subject = $this->_language->get('installation');
     $bodyArray = ['<strong>' . $this->_language->get('user') . $this->_language->get('colon') . '</strong> ' . $mailArray['adminUser'], '<br />', '<strong>' . $this->_language->get('password') . $this->_language->get('colon') . '</strong> ' . $mailArray['adminPassword'], '<br />', '<strong>' . $this->_language->get('url') . $this->_language->get('colon') . '</strong> ' . $linkElement];
     /* send mail */
     $mailer = new Mailer();
     $mailer->init($toArray, $fromArray, $subject, $bodyArray);
     return $mailer->send();
 }
Exemple #5
0
 /**
  * send the mail
  *
  * @since 3.0.0
  *
  * @param array $mailArray array of the mail
  *
  * @return boolean
  */
 protected function _mail($mailArray = [])
 {
     $urlReset = $this->_registry->get('root') . '/' . $this->_registry->get('parameterRoute') . 'login';
     /* html elements */
     $linkElement = new Element();
     $linkElement->init('a', ['href' => $urlReset, 'class' => 'link-result'])->text($urlReset);
     /* prepare mail */
     $toArray = [$mailArray['name'] => $mailArray['email']];
     $fromArray = [Db::getSetting('author') => Db::getSetting('email')];
     $subject = $this->_language->get('password_new');
     $bodyArray = ['<strong>' . $this->_language->get('password_new') . $this->_language->get('colon') . '</strong> ' . $mailArray['password'], '<br />', '<strong>' . $this->_language->get('login') . $this->_language->get('colon') . '</strong> ' . $linkElement];
     /* send mail */
     $mailer = new Mailer();
     $mailer->init($toArray, $fromArray, $subject, $bodyArray);
     return $mailer->send();
 }
 /**
  * send
  *
  * @since 2.6.0
  *
  * @param array $postData
  */
 public static function _send($postData = array())
 {
     $toArray = array(Db::getSettings('author') => Db::getSettings('email'));
     $fromArray = array($postData['author'] => $postData['email']);
     $subject = Language::get('contact');
     $bodyArray = array(Language::get('author') . Language::get('colon') . ' ' . $postData['author'], '<br />', Language::get('email') . Language::get('colon') . ' <a href="mailto:' . $postData['email'] . '">' . $postData['email'] . '</a>', '<br />', Language::get('url') . Language::get('colon') . ' <a href="' . $postData['url'] . '">' . $postData['url'] . '</a>', '<br />', Language::get('message') . Language::get('colon') . ' ' . $postData['text']);
     /* send message */
     $mailer = new Mailer();
     $mailer->init($toArray, $fromArray, $subject, $bodyArray);
     $mailer->send();
 }
Exemple #7
0
 /**
  * send the mail
  *
  * @since 3.0.0
  *
  * @param array $mailArray array of the mail
  *
  * @return boolean
  */
 protected function _mail($mailArray = [])
 {
     $urlArticle = $this->_registry->get('root') . '/' . $this->_registry->get('parameterRoute') . $mailArray['route'];
     /* html elements */
     $linkElement = new Html\Element();
     $linkElement->init('a');
     $linkEmail = $linkElement->copy();
     $linkEmail->attr(['href' => 'mailto:' . $mailArray['email']])->text($mailArray['email']);
     $linkUrl = $linkElement->copy();
     $linkUrl->attr(['href' => $mailArray['url']])->text($mailArray['url'] ? $mailArray['url'] : $this->_language->get('none'));
     $linkArticle = $linkElement->copy();
     $linkArticle->attr(['href' => $urlArticle])->text($urlArticle);
     /* prepare mail */
     $toArray = [$this->_language->get('author') => Db::getSetting('email')];
     $fromArray = [$mailArray['author'] => $mailArray['email']];
     $subject = $this->_language->get('comment_new');
     $bodyArray = ['<strong>' . $this->_language->get('author') . $this->_language->get('colon') . '</strong> ' . $mailArray['author'], '<br />', '<strong>' . $this->_language->get('email') . $this->_language->get('colon') . '</strong> ' . $linkEmail, '<br />', '<strong>' . $this->_language->get('url') . $this->_language->get('colon') . '</strong> ' . $linkUrl . '<br />', '<br />', '<strong>' . $this->_language->get('article') . $this->_language->get('colon') . '</strong> ' . $linkArticle, '<br />', '<strong>' . $this->_language->get('comment') . $this->_language->get('colon') . '</strong> ' . $mailArray['text']];
     /* send mail */
     $mailer = new Mailer();
     $mailer->init($toArray, $fromArray, $subject, $bodyArray);
     return $mailer->send();
 }
Exemple #8
0
 /**
  * mail
  *
  * @since 3.0.0
  *
  * @param array $mailArray
  *
  * @return boolean
  */
 protected static function _mail($mailArray = [])
 {
     $toArray = [Db::getSetting('author') => Db::getSetting('email')];
     $fromArray = [$mailArray['author'] => $mailArray['email']];
     $subject = Language::get('contact');
     $bodyArray = [Language::get('author') . Language::get('colon') . ' ' . $mailArray['author'], '<br />', Language::get('email') . Language::get('colon') . ' <a href="mailto:' . $mailArray['email'] . '">' . $mailArray['email'] . '</a>', '<br />', Language::get('url') . Language::get('colon') . ' <a href="' . $mailArray['url'] . '">' . $mailArray['url'] . '</a>', '<br />', Language::get('message') . Language::get('colon') . ' ' . $mailArray['text']];
     /* send mail */
     $mailer = new Mailer();
     $mailer->init($toArray, $fromArray, $subject, $bodyArray);
     return $mailer->send();
 }