2013-07-08 83 views
0

我正尝试通过使用CronJob通过亚马逊SES向我的网站的用户发送简报/提醒。亚马逊SES通过CRONJOB发送邮件获取错误

我用下面的PHP脚本通过SES

[http://sourceforge.net/projects/php-ses/?source=navbar][1] 

include("ses.php"); 
$ses = new SimpleEmailService('id', 'key'); 
$m = new SimpleEmailServiceMessage(); 
$body="Test" 
$m->addTo($mailId); 
$m->setFrom('[email protected]'); 
$m->addReplyTo('[email protected]'); 
$m->setSubject('Reminder from Site.com'); 
$m->setSubjectCharset('ISO-8859-1'); 
$m->setMessageCharset('ISO-8859-1'); 
$m->setMessageFromString('text body',$body); 
$ses->sendEmail($m); 

完成交付但是当我通过浏览器访问该文件(mailsend.php),我收到的电子邮件非常好。但是当使用由CronJob触发的这个功能时,我收到以下错误:

[08-Jul-2013 11:10:11 America/New_York] PHP Warning:
SimpleEmailService::sendEmail(): 77 error setting certificate verify locations:
CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
in /home/site/public_html/files/login/ses.php on line 356

关于问题出在哪里的想法?

+0

的cron的运行作为PHP命令行,其中有一个不同的.ini文件,通常不同的设置。比较'php -i'(命令行)''和'phpinfo()'(浏览器)输出并找出哪些设置是不同的。 –

+0

但我只有cPanel访问服务器。我们可以检查与cPanel访问? – ramesh

+0

正如Marc B指出的那样,cron作业(包括所使用的PHP版本)的总体*环境*可能与运行在Web服务器上并通过浏览器访问它完全不同。在cron /命令行下运行时似乎存在某种身份验证(“CA”)问题。您可能必须与主持人讨论此问题。 –

回答

0

添加代码

$ses->enableVerifyPeer(false); 

$ses = new SimpleEmailService('id', 'key'); 
相关问题