Classes/Service/NotificationService.php
public function sendNewCommentNotification(NodeInterface $commentNode, NodeInterface $postNode)
    {
        if ($this->settings['notifications']['to']['email'] === '') {
            return;
        }

        if (!class_exists('Neos\SwiftMailer\Message')) {
            $this->systemLogger->log('The package "Neos.SwiftMailer" is required to send notifications!');

            return;
        }

        try {
            $mail = new Message();
            $mail
                ->setFrom([$this->settings['notifications']['to']['email'] => $this->settings['notifications']['to']['name']])
                ->setReplyTo([$commentNode->getProperty('emailAddress') => $commentNode->getProperty('author')])
                ->setTo([$this->settings['notifications']['to']['email'] => $this->settings['notifications']['to']['name']])
                ->setSubject('New comment on blog post "' . $postNode->getProperty('title') . '"' . ($commentNode->getProperty('spam') ? ' (SPAM)' : ''))
                ->setBody($commentNode->getProperty('text'))
                ->send();
        } catch (\Exception $e) {
            $this->systemLogger->logException($e);
        }
    }
public function sendNewCommentNotification(NodeInterface $commentNode, NodeInterface $postNode)
    {
        if ($this->settings['notifications']['to']['email'] === '') {
            return;
        }

        if (!class_exists('Neos\SwiftMailer\Message')) {
            $this->systemLogger->log('The package "Neos.SwiftMailer" is required to send notifications!');

            return;
        }

        try {
            $mail = new Message();
            $mail
                ->setFrom([$this->settings['notifications']['to']['email'] => $this->settings['notifications']['to']['name']])
                ->setReplyTo([$commentNode->getProperty('emailAddress') => $commentNode->getProperty('author')])
                ->setTo([$this->settings['notifications']['to']['email'] => $this->settings['notifications']['to']['name']])
                ->setSubject('New comment on blog post "' . $postNode->getProperty('title') . '"' . ($commentNode->getProperty('spam') ? ' (SPAM)' : ''))
                ->setBody($commentNode->getProperty('text'))
                ->send();
        } catch (\Exception $e) {
            $this->systemLogger->logException($e);
        }
    }
public function sendNewCommentNotification ( NodeInterface $ commentNode , NodeInterface $ postNode ) { if ( $ this -> settings [ 'notifications' ] [ 'to' ] [ 'email' ] === '' ) { return ; } if ( ! class_exists ( 'Neos\SwiftMailer\Message' ) ) { $ this -> systemLogger -> log ( 'The package "Neos.SwiftMailer" is required to send notifications!' ) ; return ; } try { $ mail = new Message ( ) ; $ mail -> setFrom ( [ $ this -> settings [ 'notifications' ] [ 'to' ] [ 'email' ] => $ this -> settings [ 'notifications' ] [ 'to' ] [ 'name' ] ] ) -> setReplyTo ( [ $ commentNode -> getProperty ( 'emailAddress' ) => $ commentNode -> getProperty ( 'author' ) ] ) -> setTo ( [ $ this -> settings [ 'notifications' ] [ 'to' ] [ 'email' ] => $ this -> settings [ 'notifications' ] [ 'to' ] [ 'name' ] ] ) -> setSubject ( 'New comment on blog post "' . $ postNode -> getProperty ( 'title' ) . '"' . ( $ commentNode -> getProperty ( 'spam' ) ? ' (SPAM)' : '' ) ) -> setBody ( $ commentNode -> getProperty ( 'text' ) ) -> send ( ) ; } catch ( \ Exception $ e ) { $ this -> systemLogger -> logException ( $ e ) ; } }
Send a new notification that a comment has been created

@param NodeInterface $commentNode The comment node
@param NodeInterface $postNode The post node
@return void
Send a new notification that a comment has been created