The way it's supposed to work is that index.html submits the message directly to sendgrid.php for some reason that's not working. I've included source code of both scripts in case anyone sees any problems
Server stats:
cPanel Version: 11.48.3 (build 0)
Apache Version: 2.2.27
PHP Version: 5.4.32
Operating System: linux
index.html:
<html>
<head>
<title>Reminderbot</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" async></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css"/>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js" async></script>
<script src="//cdn.jsdelivr.net/fittext/1.2/jquery.fittext.js" async></script>
<link href='http://fonts.googleapis.com/css?family=Dosis' rel='stylesheet' type='text/css'>
<script>
$(function() {
$( "input[type=submit], a, button" )
.button();
});
</script>
<style>
body {background:#474747;}
h1 {font-family: 'Dosis', Arial, sans-serif;font-size:72pt;text-align:center;color: white;text-shadow: #000 2px 2px 2px;}
#cke_message {box-shadow: #fff 0 0 30px;margin-bottom:2%;}
</style>
</head>
<body>
<h1>Reminderbot</h1>
<form action="sendgrid.php" method="post"><textarea cols="50" rows="15" name="message" id="message"></textarea><center><input type="submit" value="Send" /></center></form>
<script src="//cdn.ckeditor.com/4.4.7/full/ckeditor.js"></script>
<script>
CKEDITOR.replace( 'message' );
</script>
</body>
</html>
sendgrid.php:
<html>
<head>
<title>SEND REPORT</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//cdn.jsdelivr.net/fittext/1.2/jquery.fittext.js"></script>
<link href='http://fonts.googleapis.com/css?family=Dosis' rel='stylesheet' type='text/css'>
<style>
h1 {
font-family: 'Dosis', Arial, sans-serif;
font-size:144pt;
}
</style>
</head>
<body align="center">
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
date_default_timezone_set('EST');
# Include the API
require 'vendor/autoload.php';
require 'lib/SendGrid.php';
require 'lib/SendGrid/Email.php';
require 'lib/Smtpapi.php';
require 'lib/Smtpapi/Header.php';
require 'html2text.php';
# Instantiate the client.
$sendgrid = new SendGrid('...', '...', array("turn_off_ssl_verification" => true));
$html = $_POST["message"];
$text = convert_html_to_text($html);
$date = date('l, F jS ');
# Make the call to the client.
$email = new SendGrid\Email();
$email
->addTo('...')
->addTo('...')
->setFrom('reminderbot@exanple.com')
->setFromName('Reminderbot')
->setSubject('New reminder for ' . $date)
->setText($text)
->setHtml($html)
->addFilter("templates", "enabled", 1)
->addFilter("templates", "template_id", "...");
$sendgrid->send($email);
print '<h1>Sent successfully</h1>';
?>
</body>
<script type="text/javascript">
$(document).ready(function() {
$("h1").lettering();
});
</script>
</html>