/** * Send confirmation/opt-in email for notifications (not yet active) * * @param Comment $comment * @param $email * @param $subcode * @return mixed * @throws WireException * */ public function ___sendConfirmationEmail(Comment $comment, $email, $subcode) { $page = $comment->getPage(); $title = $page->get('title|name'); $url = $page->httpUrl; $confirmURL = $page->httpUrl . "?comment_success=confirm&subcode={$subcode}"; $subject = $this->_('Please confirm notification') . " - {$title}"; // Email subject $body = $this->_('You requested to be notified of replies to your comment at %s. Please confirm this by clicking the link below. If you did not request this then please ignore this email.'); $bodyHTML = sprintf($body, "<a href='{$url}'>" . $this->wire('config')->httpHost . "</a>"); $body = sprintf($body, $this->wire('config')->httpHost); $footer = $this->_('Confirm Notifications'); $body .= "\n\n{$footer}: {$confirmURL}"; $bodyHTML .= "<p><strong><a href='{$confirmURL}'>{$footer}</a></strong></p>"; $mail = wireMail(); $mail->to($email)->subject($subject)->body($body)->bodyHTML($bodyHTML); $fromEmail = $this->getFromEmail(); if ($fromEmail) { $mail->from($fromEmail); } $result = $mail->send(); if ($result) { $this->wire('log')->message("Sent confirmation/opt-in email to {$email}"); } else { $this->wire('log')->error("Failed sending confirmation/opt-in email to {$email}"); } return $result; }