private function sendMail() {

		// check for configured mailer

		if(is_null($this->mailer) && !is_null(Application::getInstance()->getConfig()->mail->mailer)) {

			$mailer = Application::getInstance()->getConfig()->mail->mailer;
			$reflection = new \ReflectionClass(str_replace('/', '\\', $mailer->class));
			
			$port = isset($mailer->port) ? $mailer->port : null;
			$encryption = isset($mailer->encryption) ? $mailer->encryption : null;

			$this->mailer = $reflection->newInstanceArgs([$mailer->host, $port, $encryption]);

			if(isset($mailer->auth_type)) {
				$this->mailer->setCredentials($mailer->user, $mailer->pass, $mailer->auth_type);
			}
			else {
				$this->mailer->setCredentials($mailer->user, $mailer->pass);
			}
		}

		if(is_null($this->mailer)) {

			// use PHP's own mail() function

			$headers = [];

			foreach($this->headers as $k => $v) {
				$headers[] = iconv_mime_encode($k, $v);
			}

			mb_internal_encoding($this->encoding);

			// @todo ensure receiver to be RFC conforming

			return mail(
				implode(',', $this->receiver),
				mb_encode_mimeheader($this->subject, mb_internal_encoding(), 'Q'),
				$this->msg,
				implode(self::CRLF, $headers)
			);
		}

		else {

			// send mail with configured mailer

			try {
				$this->mailer->connect();

				$this->mailer->setFrom($this->sender);
				$this->mailer->setTo(array_merge((array) $this->receiver, $this->cc, $this->bcc));
				$this->mailer->setHeaders(array_merge(
					[
						'To' => implode(',', (array) $this->receiver),
						'Subject' => $this->subject
					],
					$this->headers
				));
				$this->mailer->setMessage($this->msg);
				$this->mailer->send();

				$this->mailer->close();
				return true;
			}

			catch(MailerException $e) {
				$this->mailer->close();
				return $e->getMessage();
			}
		}
	}
private function sendMail() {

		// check for configured mailer

		if(is_null($this->mailer) && !is_null(Application::getInstance()->getConfig()->mail->mailer)) {

			$mailer = Application::getInstance()->getConfig()->mail->mailer;
			$reflection = new \ReflectionClass(str_replace('/', '\\', $mailer->class));
			
			$port = isset($mailer->port) ? $mailer->port : null;
			$encryption = isset($mailer->encryption) ? $mailer->encryption : null;

			$this->mailer = $reflection->newInstanceArgs([$mailer->host, $port, $encryption]);

			if(isset($mailer->auth_type)) {
				$this->mailer->setCredentials($mailer->user, $mailer->pass, $mailer->auth_type);
			}
			else {
				$this->mailer->setCredentials($mailer->user, $mailer->pass);
			}
		}

		if(is_null($this->mailer)) {

			// use PHP's own mail() function

			$headers = [];

			foreach($this->headers as $k => $v) {
				$headers[] = iconv_mime_encode($k, $v);
			}

			mb_internal_encoding($this->encoding);

			// @todo ensure receiver to be RFC conforming

			return mail(
				implode(',', $this->receiver),
				mb_encode_mimeheader($this->subject, mb_internal_encoding(), 'Q'),
				$this->msg,
				implode(self::CRLF, $headers)
			);
		}

		else {

			// send mail with configured mailer

			try {
				$this->mailer->connect();

				$this->mailer->setFrom($this->sender);
				$this->mailer->setTo(array_merge((array) $this->receiver, $this->cc, $this->bcc));
				$this->mailer->setHeaders(array_merge(
					[
						'To' => implode(',', (array) $this->receiver),
						'Subject' => $this->subject
					],
					$this->headers
				));
				$this->mailer->setMessage($this->msg);
				$this->mailer->send();

				$this->mailer->close();
				return true;
			}

			catch(MailerException $e) {
				$this->mailer->close();
				return $e->getMessage();
			}
		}
	}
private function sendMail ( ) { // check for configured mailer if ( is_null ( $ this -> mailer ) && ! is_null ( Application :: getInstance ( ) -> getConfig ( ) -> mail -> mailer ) ) { $ mailer = Application :: getInstance ( ) -> getConfig ( ) -> mail -> mailer ; $ reflection = new \ ReflectionClass ( str_replace ( '/' , '\\' , $ mailer -> class ) ) ; $ port = isset ( $ mailer -> port ) ? $ mailer -> port : null ; $ encryption = isset ( $ mailer -> encryption ) ? $ mailer -> encryption : null ; $ this -> mailer = $ reflection -> newInstanceArgs ( [ $ mailer -> host , $ port , $ encryption ] ) ; if ( isset ( $ mailer -> auth_type ) ) { $ this -> mailer -> setCredentials ( $ mailer -> user , $ mailer -> pass , $ mailer -> auth_type ) ; } else { $ this -> mailer -> setCredentials ( $ mailer -> user , $ mailer -> pass ) ; } } if ( is_null ( $ this -> mailer ) ) { // use PHP's own mail() function $ headers = [ ] ; foreach ( $ this -> headers as $ k => $ v ) { $ headers [ ] = iconv_mime_encode ( $ k , $ v ) ; } mb_internal_encoding ( $ this -> encoding ) ; // @todo ensure receiver to be RFC conforming return mail ( implode ( ',' , $ this -> receiver ) , mb_encode_mimeheader ( $ this -> subject , mb_internal_encoding ( ) , 'Q' ) , $ this -> msg , implode ( self :: CRLF , $ headers ) ) ; } else { // send mail with configured mailer try { $ this -> mailer -> connect ( ) ; $ this -> mailer -> setFrom ( $ this -> sender ) ; $ this -> mailer -> setTo ( array_merge ( ( array ) $ this -> receiver , $ this -> cc , $ this -> bcc ) ) ; $ this -> mailer -> setHeaders ( array_merge ( [ 'To' => implode ( ',' , ( array ) $ this -> receiver ) , 'Subject' => $ this -> subject ] , $ this -> headers ) ) ; $ this -> mailer -> setMessage ( $ this -> msg ) ; $ this -> mailer -> send ( ) ; $ this -> mailer -> close ( ) ; return true ; } catch ( MailerException $ e ) { $ this -> mailer -> close ( ) ; return $ e -> getMessage ( ) ; } } }
evaluate mailer class and send mail

@return boolean
@throws \ReflectionException
@throws \vxPHP\Application\Exception\ApplicationException
evaluate mailer class and send mail