I have a html fieldset and a short php file for sending an email via sendgrid when the submit button is clicked.
HTML
<form id="contact-form" action="scripts/mailer.php" method="post">
<fieldset form="#contact-form">
<legend>Contact Form</legend>
<label class="input-field-name">Name:<br />
<input class="input-field" type="text" name="name" required/>
</label><br />
<label class="input-field-name">Email:<br />
<input class="input-field" type="text" name="email" required/>
</label><br />
<label class="input-field-name">Message Title:<br />
<input class="input-field" type="text" name="header" required/>
</label><br />
<label class="input-field-name">Message:<br />
<textarea class="message-field" type="text" name="message" required></textarea>
</label><br />
<button id="submit-button" type="submit">Submit</button>
</fieldset>
</form>
PHP
<?php
require_once('sendgrid-php/sendgrid-php.php');
$name = $_POST["name"];
$email = $_POST["email"];
$header = $_POST["header"];
$message = $_POST["message"];
$from = new SendGrid\Email(null, $email);
$subject = $header;
$to = new SendGrid\Email(null, "MY EMAIL ADDRESS");
$content = new SendGrid\Content("text/plain", $message);
$mail = new SendGrid\Mail($from, $subject, $to, $content);
$apiKey = 'MY API KEY';
$sg = new \SendGrid($apiKey);
$response = $sg->client->mail()->send()->post($mail);
if($response->statusCode() == 202){
echo "Email sent successfully";
}else{
echo "Email could not be sent";
}
echo $response->statusCode();
var_dump($response->headers());
echo $response->body();
I am hosting my site on GoDaddy and from everything I've been reading I believe that this should work but instead I get http error 500, my site cannot handle this request.
Any ideas of how to fix this? Thanks
Sectioned recyclerview shows after turning screen on and off
Data Retrieve from SQLITE Database is Always Same in the List [duplicate]
I'm trying to insert the data from a text file into my databaseI'm using SQL Server Management Studio 17
I have a function in my Controller where I'm trying to export acsv file using LaraCSV
I want return the number of dates which have a difference less than 30 minutesThese are the records stored in the database:
I´m consuming a WS and it gives me data as XMLWhen the response returns to my PHP it came as Object and not as XML