如何使用 mailjet API 检索列表地址?
How to retrieve a list address using mailjet API?
我正在尝试向 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).我确定它就在我面前。有人可以帮忙吗?
https://dev.mailjet.com/reference/email/contacts/contact-list/#v3_get_contactslist_list_ID
GET /contactslist/{list_ID or list_address}
[The list_address] is displayed in the Address property of the list. The full email address will be {list_address}@lists.mailjet.com. Can be used as an alternative to list_ID.
因此,如果您使用 list_ID 查询此端点,您会得到一个列表地址,您可以将其用作 @lists.mailjet.com
的前缀。
我正在尝试向 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).我确定它就在我面前。有人可以帮忙吗?
https://dev.mailjet.com/reference/email/contacts/contact-list/#v3_get_contactslist_list_ID
GET /contactslist/{list_ID or list_address}
[The list_address] is displayed in the Address property of the list. The full email address will be {list_address}@lists.mailjet.com. Can be used as an alternative to list_ID.
因此,如果您使用 list_ID 查询此端点,您会得到一个列表地址,您可以将其用作 @lists.mailjet.com
的前缀。