Running the custom task to delete mailsac inbox return 401

`the piece of code below returns 401

async deleteAllEmails(address) {`

const mailsac = new Mailsac({ headers: { "Mailsac-Key" : process.env.MAIL_PASSWORD } })

const messages = await mailsac.messages.deleteAllMessages(address);

if (messages.status === 204) {

return true ;

} else {

return false ;



this is happening after passing the correct APIKEY

Hi Eniola,

Sorry for the trouble you are having. What address are you trying to delete all the messages from? Is this an address you have configured as private or is it a public address? Feel free free to send me a message directly if you don’t want to post the address publicly here in the forums.


Thanks @mjmayer for your prompt response, i am using a public address something like
[email protected]

The REST endpoint that the deleteAllMessages method is acting on is documented here. It does state “The address must be an owned address or an address in a owned domain.” which is probably why you are seeing the 401. Try reserving the address and see if the API call works.

Let me know if that resolves your issue.