【发布时间】:2017-07-26 10:04:41
【问题描述】:
我已尝试运行以下代码以使用 PHP 中的 mailgun API 发送多封电子邮件。但是没有使用该代码发送电子邮件。我的代码是:
require 'vendor/autoload.php';
use Mailgun\Mailgun;
$mgClient = new Mailgun("my-api-key");
$domain = "sandboxfa3e9009746840be831c6edc9e9f1ee9.mailgun.org";
$result = $mgClient->sendMessage("$domain",
array('from' => 'Mailgun Sandbox - Test
<postmaster@sandboxfa3e9009746840be831c6edc9e9f1ee9.mailgun.org>',
'to' => 'email_1@gmail.com, email_2@gmail.com',
'subject' => 'Mailgun bulk-msg test for KB',
'text' => 'Your mail do not support HTML',
'html' => 'html-portion here...',
'recipient-variables' => '{"email_1@gmail.com": {"first":"Name-1",
"id":1}, "email_2@gmail.com": {"first":"Name-2", "id": 2}}')
);
var_dump($result);
?>
#===============================================
我在发送多封电子邮件的代码中是否有任何错误?如果您有任何解决方案,请提供帮助。
【问题讨论】:
-
您可能不应该共享您的 API 密钥。我建议删除它。
-
感谢您的建议