Added methods for removing suppressions from Mailgun
refs https://github.com/TryGhost/Team/issues/2255 These methods will be used by the Mailgun implementation of EmailSuppressionList so that emails are removed from both our internal list and Mailguns.
This commit is contained in:
parent
4c166e11df
commit
c6c962d5d6
@ -168,6 +168,38 @@ module.exports = class MailgunClient {
|
||||
}
|
||||
}
|
||||
|
||||
async removeSuppression(type, email) {
|
||||
if (!this.isConfigured()) {
|
||||
return false;
|
||||
}
|
||||
const instance = this.getInstance();
|
||||
const config = this.#getConfig();
|
||||
|
||||
try {
|
||||
await instance.suppressions.destroy(
|
||||
config.domain,
|
||||
type,
|
||||
email
|
||||
);
|
||||
return true;
|
||||
} catch (err) {
|
||||
logging.error(err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async removeBounce(email) {
|
||||
return this.removeSuppression('bounces', email);
|
||||
}
|
||||
|
||||
async removeComplaint(email) {
|
||||
return this.removeSuppression('complaints', email);
|
||||
}
|
||||
|
||||
async removeUnsubscribe(email) {
|
||||
return this.removeSuppression('unsubscribes', email);
|
||||
}
|
||||
|
||||
normalizeEvent(event) {
|
||||
const providerId = event?.message?.headers['message-id'];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user