mailbox.onDeleted
A mailbox was deleted or disconnected — clean up your records.
Fires when a mailbox is deleted through emailkit.mailboxes.delete(), or when a provider that hosts the connection (AIInbx) reports a disconnect by webhook — there it also carries the context you passed to mailboxes.connect(). Remove what you stored for it — the mailbox record and its auth.
hooks: {
mailbox: {
onDeleted: async ({ mailbox }) => {
await prisma.connectedMailbox.deleteMany({
where: { email: mailbox.email },
});
},
},
},
Payload
PropType
emailDriverstring
Type
stringmailboxMailbox
Type
Mailboxcontext?unknown
Type
unknown