get('plugins.email.from'); } if (!isset($grav['Email']) || empty($from)) { throw new \RuntimeException($grav['language']->translate('PLUGIN_EMAIL.PLEASE_CONFIGURE_A_FROM_ADDRESS')); } 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; } } }