为了账号安全,请及时绑定邮箱和手机立即绑定

使用 Mailgun 的官方 PHP SDK 成功排队邮件时如何读取 API 响应?

使用 Mailgun 的官方 PHP SDK 成功排队邮件时如何读取 API 响应?

PHP
莫回无 2021-11-26 17:58:28
当邮件使用 Mailgun 的官方 PHP SDK (2.8) 成功排队时,我非常困惑如何读取 API 响应。// First, instantiate the SDK with your API credentials$mg = Mailgun::create('key-example'); // For US servers$mg = Mailgun::create('key-example', 'https://api.eu.mailgun.net'); // For EU servers// Now, compose and send your message.// $mg->messages()->send($domain, $params);$response = $mg->messages()->send('example.com', [  'from'    => 'bob@example.com',  'to'      => 'sally@example.com',  'subject' => 'The PHP SDK is awesome!',  'text'    => 'It is so simple to send a message.']);var_dump($response);//Var dump resultsobject(Mailgun\Model\Message\SendResponse)#130 (2) {  ["id":"Mailgun\Model\Message\SendResponse":private]=>  string(52) "<201949588013742.1.5234966234A248269@mydomain.com>"  ["message":"Mailgun\Model\Message\SendResponse":private]=>  string(18) "Queued. Thank you."}$response 是私有对象,我无法阅读“排队。谢谢。” 在它里面。我在文档中找不到任何相关的功能来做到这一点。我在这里错过了什么吗?
查看完整描述

1 回答

?
慕无忌1623718

TA贡献1744条经验 获得超4个赞

您可以通过此获得以下数据

对于身份证:$response->getId()

对于消息: $response->getMessage()

干杯


查看完整回答
反对 回复 2021-11-26
  • 1 回答
  • 0 关注
  • 159 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信