Fixes in VERP handling.
VERP disable header option moved from config to send configurations. Some additional logging for VERP.
This commit is contained in:
parent
a769bfb567
commit
3b1986116f
7 changed files with 33 additions and 16 deletions
|
@ -13,6 +13,8 @@ const uploads = multer();
|
|||
|
||||
|
||||
router.postAsync('/aws', async (req, res) => {
|
||||
console.log(req.body);
|
||||
|
||||
if (typeof req.body === 'string') {
|
||||
req.body = JSON.parse(req.body);
|
||||
}
|
||||
|
@ -70,6 +72,8 @@ router.postAsync('/sparkpost', async (req, res) => {
|
|||
const events = [].concat(req.body || []); // This is just a cryptic way getting an array regardless whether req.body is empty, one item, or array
|
||||
|
||||
for (const curEvent of events) {
|
||||
console.log(curEvent);
|
||||
|
||||
let msys = curEvent && curEvent.msys;
|
||||
let evt;
|
||||
|
||||
|
@ -81,6 +85,8 @@ router.postAsync('/sparkpost', async (req, res) => {
|
|||
continue;
|
||||
}
|
||||
|
||||
log.verbose('Sendgrid', 'Received issue "%s" for message id "%s"', evt.type, evt.campaign_id);
|
||||
|
||||
const message = await campaigns.getMessageByCid(evt.campaign_id);
|
||||
if (!message) {
|
||||
continue;
|
||||
|
@ -119,6 +125,9 @@ router.postAsync('/sendgrid', async (req, res) => {
|
|||
continue;
|
||||
}
|
||||
|
||||
console.log(evt);
|
||||
log.verbose('Sendgrid', 'Received issue "%s" for message id "%s"', evt.event, evt.campaign_id);
|
||||
|
||||
const message = await campaigns.getMessageByCid(evt.campaign_id);
|
||||
if (!message) {
|
||||
continue;
|
||||
|
@ -153,6 +162,9 @@ router.postAsync('/sendgrid', async (req, res) => {
|
|||
router.postAsync('/mailgun', uploads.any(), async (req, res) => {
|
||||
const evt = req.body;
|
||||
|
||||
console.log(evt);
|
||||
log.verbose('Mailgun', 'Received issue "%s" for message id "%s"', evt.event, evt.campaign_id);
|
||||
|
||||
const message = await campaigns.getMessageByCid([].concat(evt && evt.campaign_id || []).shift());
|
||||
if (message) {
|
||||
switch (evt.event) {
|
||||
|
@ -187,11 +199,10 @@ router.postAsync('/zone-mta', async (req, res) => {
|
|||
|
||||
if (req.body.id) {
|
||||
const message = await campaigns.getMessageByResponseId(req.body.id);
|
||||
console.log(message);
|
||||
|
||||
if (message) {
|
||||
await campaigns.changeStatusByMessage(contextHelpers.getAdminContext(), message, SubscriptionStatus.BOUNCED, true);
|
||||
log.verbose('ZoneMTA', 'Marked message %s as bounced', req.body.id);
|
||||
log.verbose('ZoneMTA', 'Marked message (campaign:%s, list:%s, subscription:%s) as bounced', message.campaign, message.list, message.subscription);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue