Closed dazoot closed 5 years ago
Interesting question, never thought of that. I guess it should be possible as zone is defined by sendingZone property in the message queue collection in database. All you need to do to change zone would be to change this property (eg. from “default” to “someotherzone”)
Do the plugins have access to the delivery attempts (count, smtp error messages) ? Updating the sendingZone property in the plugin code, saves it to the mongo DB ?
Plugins should see previous delivery attempts from delivery._deferred
property.
I pushed out zone-mta v1.12.0 where you can update queue entry keys in db using delivery.updates
object (only applies to "sender:*"
hooks)
app.addHook('sender:headers', (delivery, connection, next) => {
if (!delivery.updates) {
// make sure the updates object exists
delivery.updates = {};
}
// override Zone for this message if it is deferred, no effect if message bounces or is accepted
delivery.updates.sendingZone = 'someother';
next();
});
Plugins should see previous delivery attempts from
delivery._deferred
property.I pushed out zone-mta v1.12.0 where you can update queue entry keys in db using
delivery.updates
object (only applies to"sender:*"
hooks)app.addHook('sender:headers', (delivery, connection, next) => { if (!delivery.updates) { // make sure the updates object exists delivery.updates = {}; } // override Zone for this message if it is deferred, no effect if message bounces or is accepted delivery.updates.sendingZone = 'someother'; next(); });
Hi, is this still working?
I tried, and it didn't work.
There's something to be customized?
Yes it works fine.
We use this:
delivery._deferred.response
To see the actual bounce message.
And:
let deferredCount = (delivery._deferred && delivery._deferred.count) || 0;
To see the actual deferred count.
Hi,
Thank you so much @dazoot .
But could you show more of your code that you used to solve the problem? I'm new to JavaScript, I don't know what context to use, seeing a little more would help me a lot.
Hello, I won't need your code model anymore, with your help in another issue I managed to finish the development of plugin #299
Is it possible to change the sendingZone of an existing queued message ? I am investigating if we can do a sendingZone failover plugin, after X delivery attempts for example.