向多个收件人发送消息的 Mailgun 调用不会返回给调用者 - 提供的示例
Mailgun call to send message to multiple recipients is not returning to caller - example provided
我们正在尝试使用 Mailgun PHP API.
向多个收件人发送电子邮件
我们是 运行 MG PHP lib 版本 2.8.1.
我们的代码执行以下操作:
注意:出于隐私原因更改了电子邮件地址和域
log_debugger('g1', 'g1');
$params = array(
'from' => $msg_org . " <" . EMAIL_SENDER . ">",
'to' => array('joe@gmail.com'),
'subject' => 'Hey %recipient.first%',
'text' => 'If you wish to unsubscribe, click http://example.com/unsubscribe/%recipient.id%',
'recipient-variables' => '{"joe@gmail.com": {"first":"Joe", "id":1}}'
);
log_debugger('g1', 'g2');
# Make the call to the client.
$mgresult = $mgClient->messages()->send(MAILGUN_DOMAIN, $params);
log_debugger('g1', 'g3');
// if the email was accepted by Mailgun then indicate the member message was delivered
if ($mgresult->http_response_code >= 200 && $mgresult->http_response_code < 300) {
log_debugger('mgr', $mgresult->http_response_code);
// else the email was not accepted by mailgun so indicate the member message failed to be delivered
} else {
log_debugger('g1', 'g4');
}
呼叫成功到达 MG,但我们没有从 MG 收到任何 return。我们已经成功发送给 MG 一段时间了,现在我们正试图一次发送到多个电子邮件地址。下面是我们传递的调试日志记录的数据。
2020-08-14 12:47:01 g1
2020-08-14 12:47:01 g1
2020-08-14 12:47:01 g1
2020-08-14 12:47:01 g2
这是 MG 文档 - 请注意错误:messages()-send 应该是 messages()->send
require 'vendor/autoload.php';
use Mailgun\Mailgun;
// Instantiate the client.
$mgClient = Mailgun::create('PRIVATE_API_KEY', 'https://API_HOSTNAME');
$domain = "YOUR_DOMAIN_NAME";
$params = array(
'from' => 'Excited User <YOU@YOUR_DOMAIN_NAME>',
'to' => array('bob@example.com, alice@example.com'),
'subject' => 'Hey %recipient.first%',
'text' => 'If you wish to unsubscribe, click http://example.com/unsubscribe/%recipient.id%',
'recipient-variables' => '{"bob@example.com": {"first":"Bob", "id":1},
"alice@example.com": {"first":"Alice", "id": 2}}'
);
// Make the call to the client.
$result = $mgClient->messages()-send($domain, $params);
如能提供任何帮助使其正常工作,我们将不胜感激。已向 MG 提交工单,但尚未收到回复。
MG记录的发送消息的方法不太正确。我不得不从以下位置更改呼叫:
$mgresult = $mailgun_client->messages()->send(MAILGUN_DOMAIN, array(
至:
$mgresult = $mailgun_client->sendMessage(MAILGUN_DOMAIN, array(
我们正在尝试使用 Mailgun PHP API.
向多个收件人发送电子邮件
我们是 运行 MG PHP lib 版本 2.8.1.
我们的代码执行以下操作: 注意:出于隐私原因更改了电子邮件地址和域
log_debugger('g1', 'g1');
$params = array(
'from' => $msg_org . " <" . EMAIL_SENDER . ">",
'to' => array('joe@gmail.com'),
'subject' => 'Hey %recipient.first%',
'text' => 'If you wish to unsubscribe, click http://example.com/unsubscribe/%recipient.id%',
'recipient-variables' => '{"joe@gmail.com": {"first":"Joe", "id":1}}'
);
log_debugger('g1', 'g2');
# Make the call to the client.
$mgresult = $mgClient->messages()->send(MAILGUN_DOMAIN, $params);
log_debugger('g1', 'g3');
// if the email was accepted by Mailgun then indicate the member message was delivered
if ($mgresult->http_response_code >= 200 && $mgresult->http_response_code < 300) {
log_debugger('mgr', $mgresult->http_response_code);
// else the email was not accepted by mailgun so indicate the member message failed to be delivered
} else {
log_debugger('g1', 'g4');
}
呼叫成功到达 MG,但我们没有从 MG 收到任何 return。我们已经成功发送给 MG 一段时间了,现在我们正试图一次发送到多个电子邮件地址。下面是我们传递的调试日志记录的数据。
2020-08-14 12:47:01 g1
2020-08-14 12:47:01 g1
2020-08-14 12:47:01 g1
2020-08-14 12:47:01 g2
这是 MG 文档 - 请注意错误:messages()-send 应该是 messages()->send
require 'vendor/autoload.php';
use Mailgun\Mailgun;
// Instantiate the client.
$mgClient = Mailgun::create('PRIVATE_API_KEY', 'https://API_HOSTNAME');
$domain = "YOUR_DOMAIN_NAME";
$params = array(
'from' => 'Excited User <YOU@YOUR_DOMAIN_NAME>',
'to' => array('bob@example.com, alice@example.com'),
'subject' => 'Hey %recipient.first%',
'text' => 'If you wish to unsubscribe, click http://example.com/unsubscribe/%recipient.id%',
'recipient-variables' => '{"bob@example.com": {"first":"Bob", "id":1},
"alice@example.com": {"first":"Alice", "id": 2}}'
);
// Make the call to the client.
$result = $mgClient->messages()-send($domain, $params);
如能提供任何帮助使其正常工作,我们将不胜感激。已向 MG 提交工单,但尚未收到回复。
MG记录的发送消息的方法不太正确。我不得不从以下位置更改呼叫:
$mgresult = $mailgun_client->messages()->send(MAILGUN_DOMAIN, array(
至:
$mgresult = $mailgun_client->sendMessage(MAILGUN_DOMAIN, array(