Closed vivekpatel5996 closed 1 year ago
Any idea how to achieve this? @louis-lau
You need to reject the email. Otherwise, the specific plugin is logged as failed.
throw app.reject(envelope, 'reject', messageInfo, 'No DKIM available')
See this example: https://github.com/zone-eu/zone-mta/blob/master/plugins/core/rspamd/index.js#L102
Hi @andris9.
Thanks for the reply. But it seems it works only with message:queue
hooks and not the sender:connection
.
Thanks,
@andris9, your help would be much appreciated. Thank you
Hello,
I am throwing an error from the
sender:connection
hook, even though next hooks are called and mail is delivered.I have some condition that checks if DKIM is not available then throw the error and not proceed further hooks and drop the message but still it's processing and printing console from
sender:delivered
hook.app.addHook('sender:connection', async (delivery, options, next) => { throw new Error("No DKIM available") }
app.addHook('sender:delivered', async (delivery, info, next) => { console.log("Delivered") }
Anyone can help on how to throw the error and not processing further hooks ?
And is there any proper way to drop the message from the queue and not process that particular message ?
Thanks.