public function send(string $address, string $subject, ?string $message = null): bool
    {
        // try to get message from global if not passed direct
        if ($message === null) {
            $message = $this->message;
        }

        try {
            if ($message === null) {
                throw new \Exception('Message body is empty!');
            }

            // try to build message and send it
            $message = (new \Swift_Message($subject))
                ->setFrom($this->from)
                ->setTo($address)
                ->setBody($message, 'text/html');
            $this->swift->send($message);
            return true;
        } catch (\Exception $e) {
            if (App::$Debug) {
                App::$Debug->addException($e);
                App::$Debug->addMessage('Send mail failed! Info: ' . $e->getMessage(), 'error');
            }
            return false;
        }
    }
public function send(string $address, string $subject, ?string $message = null): bool
    {
        // try to get message from global if not passed direct
        if ($message === null) {
            $message = $this->message;
        }

        try {
            if ($message === null) {
                throw new \Exception('Message body is empty!');
            }

            // try to build message and send it
            $message = (new \Swift_Message($subject))
                ->setFrom($this->from)
                ->setTo($address)
                ->setBody($message, 'text/html');
            $this->swift->send($message);
            return true;
        } catch (\Exception $e) {
            if (App::$Debug) {
                App::$Debug->addException($e);
                App::$Debug->addMessage('Send mail failed! Info: ' . $e->getMessage(), 'error');
            }
            return false;
        }
    }
public function send ( string $ address , string $ subject , ? string $ message = null ) : bool { // try to get message from global if not passed direct if ( $ message === null ) { $ message = $ this -> message ; } try { if ( $ message === null ) { throw new \ Exception ( 'Message body is empty!' ) ; } // try to build message and send it $ message = ( new \ Swift_Message ( $ subject ) ) -> setFrom ( $ this -> from ) -> setTo ( $ address ) -> setBody ( $ message , 'text/html' ) ; $ this -> swift -> send ( $ message ) ; return true ; } catch ( \ Exception $ e ) { if ( App :: $ Debug ) { App :: $ Debug -> addException ( $ e ) ; App :: $ Debug -> addMessage ( 'Send mail failed! Info: ' . $ e -> getMessage ( ) , 'error' ) ; } return false ; } }
Set mail to address
@param string $address
@param string $subject
@param null|string $message
@return bool
Set mail to address