我不断收到InvalidArgumentException: Invalid resource type: boolean
一些通过邮戳发送的电子邮件。有些正在工作,有些则没有。我看不出正在工作的电子邮件和有错误的电子邮件有什么不同。他们使用相同的参数运行相同的代码。
这是我传递给邮戳的内容:
$client = new PostmarkClient($config->postmark->token);
$sendResult = $client->sendEmail(
$config->postmark->sender,
$recipient,
$subject,
$html_body,
$text_body,
null, true, null, null, null, null, $attachments
);
这是调用堆栈:
vendor/guzzlehttp/streams/src/Stream.php in factory at line 85
throw new \InvalidArgumentException('Invalid resource type: ' . $type);
vendor/guzzlehttp/guzzle/src/Message/MessageFactory.php in applyOptions at line 345
$request->setBody(Stream::factory(json_encode($value)));
vendor/guzzlehttp/guzzle/src/Message/MessageFactory.php in createRequest at line 98
$this->applyOptions($request, $options);
vendor/guzzlehttp/guzzle/src/Client.php in createRequest at line 120
return $this->messageFactory->createRequest($method, $url, $options);
vendor/wildbit/postmark-php/src/Postmark/PostmarkClientBase.php in processRestRequest at line 101
$request = $client->createRequest($method, $url, $options);
vendor/wildbit/postmark-php/src/Postmark/PostmarkClient.php in sendEmail at line 61
return new DynamicResponseModel($this->processRestRequest('POST', '/email', $body));
library/send_mail.php in send_mail at line 86
我已经用谷歌搜索了一段时间,但没有找到任何可以理解这一点的东西。
我看过这里: https ://laracasts.com/discuss/channels/general-discussion/mandrill-trouble-invalid-resource-type-boolean 和这里: https ://laracasts.com/forum/?p=2325 -problems-using-mandrill/0但两者都与 Laravel + Mandrill 有问题,但我使用的是 Postmark 并且没有框架。然而,我们确实有 Guzzle 的共同点。这两个帖子都说他们通过更新或重新安装他们的 Guzzle 来处理它。
我似乎正在运行 Guzzle 的“工作”版本。Guzzle 的 GitHub 问题 #628似乎正是我所看到的,但该问题说它已在 4.0.2 中修复,我在 Guzzle 5.3 上:
从我composer.lock
的服务器上:
{
"name": "guzzlehttp/guzzle",
"version": "5.3.0"
},
...
{
"name": "guzzlehttp/streams",
"version": "3.0.0"
},
...
{
"name": "wildbit/postmark-php",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/wildbit/postmark-php",
"reference": "2eabc627c3f2a693b986e51d2f892cc2e2d065b3"
},
"require": {
"guzzlehttp/guzzle": "~5.1",
"php": ">=5.4.0"
},
}
有什么想法吗?