I added the basic version of SendGrid to Heroku so we could send user-feedback emails from our website. The basic testing implementation I’m using is below:
<?php
/**** Takes posted content from 'contact.html' and sends us an email *****/
require 'sendgrid-php/SendGrid_loader.php';
$sendgrid = new SendGrid('username', 'pwd');
$mail = new SendGrid\Mail();
$mail->
addTo('matthewpolega@gmail.com')->
setFrom('matthewpolega@gmail.com')->
setSubject('another')->
setText('Hello World!')->
setHtml('<strong>Hello World!</strong>');
$sendgrid->
smtp->
send($mail);
header( 'Location: contact.html' );
?>
It works fine in localhost testing. However, it stalls when I test it online. Has anybody experienced a problem like this?
It sounds like you’re having some issues with submodules on Heroku. There are two ways you can fix this:
1) Figure out what you did wrong by reading the heroku submodule docs. It’s probably as simple as
git submodule add path/to/sendgrid2) Remove the
.gitdirectory in the SendGrid module and check it in to your repo: