added email template, mail api and mail utility class, tweak to Mailer.js
parent
89f84499b2
commit
bedb6fdfe5
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class MailerAPI
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function handleMail($request, $body, $response)
|
||||
{
|
||||
$result = Mailer::sendmail($request, $body, $response);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
use Slim\Views\Twig;
|
||||
|
||||
class Mailer
|
||||
{
|
||||
public static function sendMail($request, $body, $response)
|
||||
{
|
||||
$view = Twig::fromRequest($request);
|
||||
|
||||
$render = $view->render($response, "dash/email.twig", [
|
||||
"title" => "EMAIL TESTER",
|
||||
"header" => "Snarky Descriptor",
|
||||
"content" => $body["content"],
|
||||
]);
|
||||
|
||||
$email = $render->getBody()->getContents();
|
||||
echo $email;
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
|
||||
<title>
|
||||
{{title}}
|
||||
</title>
|
||||
<style type="text/css">
|
||||
/* reset */
|
||||
#outlook a {
|
||||
padding: 0;
|
||||
}
|
||||
/* Force Outlook to provide a "view in browser" menu link. */
|
||||
.ExternalClass {
|
||||
width: 100%;
|
||||
}
|
||||
/* Force Hotmail to display emails at full width */
|
||||
.ExternalClass,
|
||||
.ExternalClass p,
|
||||
.ExternalClass span,
|
||||
.ExternalClass font,
|
||||
.ExternalClass td,
|
||||
.ExternalClass div {
|
||||
line-height: 100%;
|
||||
}
|
||||
/* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */
|
||||
p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 0px;
|
||||
line-height: 0px;
|
||||
}
|
||||
/* squash Exact Target injected paragraphs */
|
||||
table td {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
/* Outlook 07, 10 padding issue fix */
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
mso-table-lspace: 0pt;
|
||||
mso-table-rspace: 0pt;
|
||||
}
|
||||
/* remove spacing around Outlook 07, 10 tables */
|
||||
/* bring inline */
|
||||
img {
|
||||
display: block;
|
||||
outline: none;
|
||||
text-decoration: none;
|
||||
-ms-interpolation-mode: bicubic;
|
||||
}
|
||||
a img {
|
||||
border: none;
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #000001;
|
||||
}
|
||||
/* text link */
|
||||
a.phone {
|
||||
text-decoration: none;
|
||||
color: #000001 !important;
|
||||
pointer-events: auto;
|
||||
cursor: default;
|
||||
}
|
||||
/* phone link, use as wrapper on phone numbers */
|
||||
span {
|
||||
font-size: 13px;
|
||||
line-height: 17px;
|
||||
font-family: monospace;
|
||||
color: #000001;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table cellpadding='0' cellspacing='0' border='0' style="margin:0; padding:0; width:100%; line-height: 100% !important;">
|
||||
<tr>
|
||||
<td valign='top'>
|
||||
{# edge wrapper #}
|
||||
<table cellpadding='0' cellspacing='0' border='0' align='center' width='600' style='background: #374857;'>
|
||||
<tr>
|
||||
<td valign='top' style='vertical-align: top;')>
|
||||
{# info table start #}
|
||||
<table cellpadding='0' cellspacing='0' border='0' align='center' style='width:100%'>
|
||||
<tr>
|
||||
<td valign='top' style='vertical-align: top;text-align: center; padding: 10px'>
|
||||
<span style='font-family: Arial,Helvetica Neue,Helvetica,sans-serif; color:#f5ab35; font-size:20px; font-weight: bold;'>
|
||||
{{ header }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' style='vertical-align: top; background: #161d23; padding:10px;'>
|
||||
<span style='font-family: Arial,Helvetica Neue,Helvetica,sans-serif; color:#cecece; font-size:16px;'>
|
||||
{{ content }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' style='vertical-align: top; padding: 10px;'>
|
||||
<span style='font-family: Arial,Helvetica Neue,Helvetica,sans-serif; color:#b2cce5; font-size:12px;'>
|
||||
{{ footer }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{# info table end #}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue