Vandelay can not export: "You have to authenticate first"

Your question

I had to fresh install Stalwart 0.16 due to upgrade errors. Now I am trying to export the mails to this new installation; from an archive I imported with vandelay before destroying the working copy of v0.16

Now I am using the docs provided here and Github:

export VANDELAY_PASSWORD='target-password'
vandelay export \
  --url https://jmap.example.org \
  --auth-basic [email protected] \
  --account-name [email protected] \
  alice.sqlite

This format returns HTTP 401 with the message “You have to authenticate first”.

How?

The user I am trying to export data of is newly created and does not have OTP enabled.

That message is Stalwart’s generic “authentication failed or missing” response, so the username and password Vandelay sent didn’t authenticate against the new server. Since you’ve confirmed there’s no OTP, it isn’t an MFA issue (that would be a different status).

Quickest way to isolate it is to test the same login without Vandelay in the picture: curl -u ‘[email protected]:thepassword’ https://jmap.example.org/.well-known/jmap. If that also returns 401, the problem is the account or password on the new server, not Vandelay. On a fresh install, make sure the account actually exists in your configured directory with a password set, and that [email protected] is a real login for it (not only an alias). It’s also worth checking, if a reverse proxy sits in front, that it isn’t stripping the Authorization header, which produces this same 401. The server’s auth-failure log entry will say whether it saw an unknown account or a bad password, which pins it down.

I ignored the VANDELAY_PASSWORD ENV var and I passed the password via --auth-password argument and it successfully exported.

Thank you for your time.