首页 > 解决方案 > MailGun 取消订阅

问题描述

我正在使用 PHP 的 CURL 函数使用 MailGun 返回我域中所有未订阅的电子邮件。我尝试了以下代码:

function get_unsubscriptions() {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    curl_setopt($ch, CURLOPT_USERPWD, 'api:key-[key removed]');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
    curl_setopt($ch, CURLOPT_URL, 'https://api.mailgun.net/v3/[domain removed]/unsubscriptions');

    $result = curl_exec($ch);

    curl_close($ch);
    return $result;
}

但它只返回以下内容:

Mailgun 华丽的 API

我究竟做错了什么?

标签: phpcurlmailgun

解决方案


推荐阅读