setFrom($from_email, $from_name); $email->setSubject($subject); $email->addTo($to_email_address, $to_name); $email->addContent("text/html", $body); $sendgrid = new \SendGrid($sendgrid_key); try { $response = $sendgrid->send($email); //print $response->statusCode() . "\n"; //print_r($response->headers()); //print $response->body() . "\n"; } catch (Exception $e) { echo 'Caught exception: '. $e->getMessage() ."\n"; } } if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); exit(); } ?>