get('plugins.email.from'); } if (!isset($grav['Email']) || empty($from)) { throw new \RuntimeException($grav['language']->translate('PLUGIN_EMAIL.EMAIL_NOT_CONFIGURED')); } if (empty($to) || empty($subject) || empty($content)) { return false; } //Initialize twig if not yet initialized $grav['twig']->init(); $body = $grav['twig']->processTemplate('email/base.html.twig', ['content' => $content]); $message = $grav['Email']->message($subject, $body, $mimetype) ->setFrom($from) ->setTo($to); $sent = $grav['Email']->send($message); if ($sent < 1) { return false; } else { return true; } } }