【发布时间】:2019-04-05 20:40:14
【问题描述】:
我正在尝试向 mailjet 列表中的每个人发送一些电子邮件。这是我到目前为止所拥有的:
public function sendToListByListName($listName, $config, $vars)
{
//First we get the list ID from the list name stored in our local settings file.
if (array_key_exists($listName, $this->config['lists']) && $this->config['lists'][$listName] !== null) {
$listId = $this->config['lists'][$listName];
} else {
return false;
}
//TODO: Get the list email address (for example, tb10xdrjm@lists.mailjet.com) via a mailjet API call
$listAddress = '?? API CALL HERE ??';
//Now we use our sendEmailTo() method to send a group email to the list
return $this->sendEmailTo($listAddress, $config, $vars);
}
(sendEmailTo() 方法是一些同事已经定义的本地方法。他们目前正在使用它向个人发送电子邮件。)
我翻遍了 mailjet API 文档,但找不到将列表 ID(如 12345)转换为其等效地址(如 tb10xdrjm@lists.mailjet.com)的方法。我确定它就在我面前。有人可以帮忙吗?
【问题讨论】:
-
谢谢。我现在使用
$response = $this->client->post(Resources::$Contactslist, ['list_ID' => $listId]);并返回一个 400 代码响应。我已经验证$listId是一个有效的列表 ID,所以我对这个响应感到困惑。 -
我链接到的那个绿色的小药丸说“得到”……
-
做到了。再次感谢。