我在SendHrid中添加了基本版本的Heroku,以便我们可以从我们的网站发送用户反馈电子邮件。我使用的基本测试实现如下:Sendgrid/PHP/Heroku无法正常工作
<?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('[email protected]')->
setFrom('[email protected]')->
setSubject('another')->
setText('Hello World!')->
setHtml('<strong>Hello World!</strong>');
$sendgrid->
smtp->
send($mail);
header('Location: contact.html');
?>
它在本地主机测试中工作正常。但是,当我在线测试时,它会停止。有没有人遇到过这样的问题?
你能给你遇到问题的一些细节?如果你在你的代码的重要事件周围放置一些'echo'声明,你看到了什么? (需要,实例化,发送等)。你确定你的凭据是正确的吗?请求是否真的超时? – Swift 2013-02-18 00:24:14
我把所有的文件放在我的heroku_upload文件夹中。 sendgrid目录已提交,但不包含内容。当我尝试添加像'git add sendgrid-php/*'时,我得到'致命的:路径'sendgrid-php/MIT.LICENSE'在子模块'sendgrid-php'中。我不认为我正确处理子模块。我在SendGrid_loader.php中加入了一个'echo',并试图将它包含在我的索引页中,但它没有显示任何内容。 – user1114864 2013-02-20 01:07:01