# IMAP connection on startup

**URL:** <https://discuss.kde.org/t/imap-connection-on-startup/50125>\
**Category:** Help\
**Tags:** kmail, akonadi\
**Created:** [September 12, 2026, 12:23pm UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125 "2026-09-12T12:23:19Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![michele.mazza](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/michele.mazza/32/391_2.png) [@michele.mazza](https://discuss.kde.org/u/michele.mazza)\
**Post date:** [September 12, 2026, 12:23pm UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/1 "2026-09-12T12:23:20Z")

</div>

I’m using Kmail 6.8.1 with Proton Mail, which requires Proton Mail Bridge, an app that exposes a local IMAP server.

On startup I get an alert from “IMAP E-Mail Server” saying:

> The IMAP server for account Proton refused the supplied username and password.  
> Do you want to try again, or open the settings?  
> Login failed, server replied: A000004 NO no such user

Since this does not repeat during the session, I’m assuming the connection is attempted before Proton Mail Bridge is ready.

My questions are:

1. is “IMAP E-Mail Server” Akonadi? (if not, who?)
2. can I prevent it from connecting on startup, and do it only when I run Kmail?

Thank you in advance for any replies.

---

<div class="post-metadata">

**Author:** ![krake](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/krake/32/17398_2.png) [@krake](https://discuss.kde.org/u/krake)\
**Post date:** [September 12, 2026, 1:11pm UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/2 "2026-09-12T13:11:54Z")

</div>

> [@michele.mazza](#):
>
> 1. is “IMAP E-Mail Server” Akonadi? (if not, who?)

Yes, ver likely.

> [@michele.mazza](#):
>
> 1. can I prevent it from connecting on startup, and do it only when I run Kmail?

Each “Receving” account in KMail’s setting as a drop down next to it.

One of the options is to make it disconnect when KMail is closed.  
This should also make it only connect when KMail is started again

---

<div class="post-metadata">

**Author:** ![michele.mazza](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/michele.mazza/32/391_2.png) [@michele.mazza](https://discuss.kde.org/u/michele.mazza)\
**Post date:** [September 12, 2026, 3:26pm UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/3 "2026-09-12T15:26:41Z")

</div>

I just rebooted to test this but unfortunately it had no effect, same error message.

---

<div class="post-metadata">

**Author:** ![nite\_route](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/nite_route/32/36239_2.png) [@nite\_route](https://discuss.kde.org/u/nite_route)\
**Post date:** [September 12, 2026, 4:28pm UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/4 "2026-09-12T16:28:04Z")

</div>

yeah that “no such user” once at boot is almost always Akonadi hitting Bridge before Bridge finished starting.

the disconnect-on-close setting wont help that race. what usually works for me:

1. make Proton Mail Bridge start on login (autostart)

2. delay Akonadi a bit, or restart the resource after Bridge is up:

`systemctl --user restart akonadi`

if you want it automatic, a tiny user systemd drop-in that runs `akonadictl restart` a few seconds after Bridge has been used to clear that first popup for me. you can also ignore the one-shot dialog if mail works the rest of the session. not great UX but it is a startup ordering thing more than bad credentials.

---

<div class="post-metadata">

**Author:** ![bednar](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/bednar/32/29625_2.png) [@bednar](https://discuss.kde.org/u/bednar)\
**Post date:** [September 12, 2026, 6:20pm UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/5 "2026-09-12T18:20:33Z")

</div>

> [@nite\_route](#):
>
> better 2: delay Akonadi a bit, or restart the resource after Bridge is up:

Better 2 : Make the systemd user session manage the Proton bridge, and add a “Before=akonadi\_control” directive to the Proton Bridge unit.

Restarting Akonadi “randomly” after 30s is just asking for more randomness.

Also please report this to Proton Bridge. It should have a user unit (preferrably with the “Before” directive included), and it definitely shouldn’t return “no such user” while starting up.

---

<div class="post-metadata">

**Author:** ![michele.mazza](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/michele.mazza/32/391_2.png) [@michele.mazza](https://discuss.kde.org/u/michele.mazza)\
**Post date:** [September 13, 2026, 10:22am UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/6 "2026-09-13T10:22:56Z")

</div>

After learning a bit about systemd units, I removed the Proton Mail Bridge autostart and enabled this systemd user unit I wrote:

~/.config/systemd/user/protonmail-bridge.service

```ini
[Unit]
Description=Proton Mail Bridge (IMAP/SMTP bridge for Proton Mail)
Documentation=https://proton.me/mail/bridge
# Make sure Bridge is fully started before Akonadi initializes its mail resources
Before=akonadi_control.service
After=graphical-session.target
PartOf=graphical-session.target

[Service]
Type=simple
ExecStart=/usr/bin/protonmail-bridge --no-window
Restart=on-failure
RestartSec=5

[Install]
WantedBy=default.target

```

It appears to be working as expected, no more errors on startup.

Still, I wish I could tell Akonadi there’s no need to rush with IMAP servers.

---

<div class="post-metadata">

**Author:** ![michele.mazza](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/michele.mazza/32/391_2.png) [@michele.mazza](https://discuss.kde.org/u/michele.mazza)\
**Post date:** [September 13, 2026, 10:36am UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/7 "2026-09-13T10:36:31Z")

</div>

Btw, experimenting with the Bridge cli options I found other issues I’ll need to report to Proton.

---

<div class="post-metadata">

**Author:** ![krake](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/krake/32/17398_2.png) [@krake](https://discuss.kde.org/u/krake)\
**Post date:** [September 13, 2026, 10:40am UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/8 "2026-09-13T10:40:13Z")

</div>

> [@michele.mazza](#):
>
> I just rebooted to test this but unfortunately it had no effect, same error message.

Interesting, I would have expected this to work.

This option should turn the connector “offline” when KMail quits and it should not attempt connects when being in that state

---

<div class="post-metadata">

**Author:** ![michele.mazza](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/michele.mazza/32/391_2.png) [@michele.mazza](https://discuss.kde.org/u/michele.mazza)\
**Post date:** [September 13, 2026, 10:47am UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/9 "2026-09-13T10:47:07Z")

</div>

Maybe it has no effect on Akonadi startup only, before Kmail is even started.

Actually, in that same dropdown you mentioned, there’s a “Check mail on startup” option (which was already off for me). I would have thought it mattered in this case, but I assume it’s strictly for Kmail and is not passed to Akonadi.

---

<div class="post-metadata">

**Author:** ![krake](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/krake/32/17398_2.png) [@krake](https://discuss.kde.org/u/krake)\
**Post date:** [September 13, 2026, 10:49am UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/10 "2026-09-13T10:49:51Z")

</div>

> [@michele.mazza](#):
>
> Maybe it has no effect on Akonadi startup only, before Kmail is even started.

I think the online/offline state used to be stored but maybe that changed.

> [@michele.mazza](#):
>
> assume it’s strictly for Kmail and is not passed to Akonadi.

Yes, that one might indeed be KMail specific, i.e. making it request a mail check on startup

---

<div class="post-metadata">

**Author:** ![bednar](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/bednar/32/29625_2.png) [@bednar](https://discuss.kde.org/u/bednar)\
**Post date:** [September 13, 2026, 10:59am UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/11 "2026-09-13T10:59:23Z")

</div>

Nice job, glad it works. On question of interest: does it need

```auto
After=graphical-session.target

```

?  
with `--no-window` I’d expect not. The `PartOf` definitely is necessary. But this is purely out of interest.

---

<div class="post-metadata">

**Author:** ![michele.mazza](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/michele.mazza/32/391_2.png) [@michele.mazza](https://discuss.kde.org/u/michele.mazza)\
**Post date:** [September 13, 2026, 3:13pm UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/12 "2026-09-13T15:13:58Z")

</div>

I also was unsure about that. I asked an LLM (Proton’s Lumo specifically) to explain various unit clauses, and it thinks “it only launches once your desktop session exists”.

Please note `--no-window` was the autostart option and it launches the graphical app, it just keeps the window closed. There is the `--noninteractive` option that I wanted to go with, but the process eventually terminated with some gRPC issue that I still need to investigate.

---

<div class="post-metadata">

**Author:** ![bednar](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/bednar/32/29625_2.png) [@bednar](https://discuss.kde.org/u/bednar)\
**Post date:** [September 13, 2026, 6:28pm UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/13 "2026-09-13T18:28:46Z")

</div>

> [@michele.mazza](#):
>
> I also was unsure about that. I asked an LLM (Proton’s Lumo specifically) to explain various unit clauses, and it thinks “it only launches once your desktop session exists”.
> 
> Please note `--no-window` was the autostart option and it launches the graphical app, it just keeps the window closed.

That’s correct. It probably needs the session to exist. It seems to be a Qt GUI program, and that requires loading the correct platform, for that the session needs to exist.. `--noninteractive` might change it into a non-gui program. Unless you’re curious and have fun doing it, leave it be…

---

<div class="post-metadata">

**Author:** ![michele.mazza](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/michele.mazza/32/391_2.png) [@michele.mazza](https://discuss.kde.org/u/michele.mazza)\
**Post date:** [September 14, 2026, 5:11pm UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/14 "2026-09-14T17:11:32Z")

</div>

Yeah I’m somewhat curious, 'cause I feel the `--noninteractive` mode is how the Bridge should work.

On a disappointing note, I just rebooted my machine and got the error message again. Now I need to learn how to debug systemd to understand why Akonadi was too early. First guess, when the ExecStart target returns it moves on to the next (Akonadi), but that doesn’t mean that the Bridge account is available yet.

---

<div class="post-metadata">

**Author:** ![bednar](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/bednar/32/29625_2.png) [@bednar](https://discuss.kde.org/u/bednar)\
**Post date:** [September 15, 2026, 8:09pm UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/15 "2026-09-15T20:09:27Z")

</div>

> [@michele.mazza](#):
>
> First guess, when the ExecStart target returns it moves on to the next

That’s because your protonmail-bridge unit’s Service type is `simple`. That means systemd considers it started the moment the process is forked/execed off. I hadn’t realized protonmail-bridge has no way to signal that it’s actually ready for operation.

---

<div class="post-metadata">

**Author:** ![michele.mazza](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/michele.mazza/32/391_2.png) [@michele.mazza](https://discuss.kde.org/u/michele.mazza)\
**Post date:** [September 16, 2026, 10:23pm UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/16 "2026-09-16T22:23:29Z")

</div>

I see I should try and use the `exec` type, but it may not be enough of a headstart over Akonadi. I’d also like to try `oneshot` with the `--noninteractive` mode which actually exits after launch, but it’s now delayed by that gRPC issue. I’ll look into that.

---

<div class="post-metadata">

**Author:** ![bednar](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/bednar/32/29625_2.png) [@bednar](https://discuss.kde.org/u/bednar)\
**Post date:** [September 17, 2026, 10:41am UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/17 "2026-09-17T10:41:13Z")

</div>

Maybe a combination of [proton-bridge cli](https://proton.me/support/bridge-cli-guide) and `ExecStartPost` would work better? I don’t use proton, so I’m going on official docs only.

---

<div class="post-metadata">

**Author:** ![michele.mazza](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/michele.mazza/32/391_2.png) [@michele.mazza](https://discuss.kde.org/u/michele.mazza)\
**Post date:** [September 20, 2026, 2:17pm UTC](https://discuss.kde.org/t/imap-connection-on-startup/50125/18 "2026-09-20T14:17:47Z")

</div>

I see my mistake now. I’m running Garuda (Arch), which provides two packages:

- protonmail-bridge
- protonmail-bridge-core

Any non-graphical options should be passed straight to protonmail-bridge-core instead of protonmail-bridge, which solves the gRPC issue.

This is the updated systemd unit:

```ini
[Unit]
Description=Proton Mail Bridge (IMAP/SMTP bridge for Proton Mail)
Documentation=https://proton.me/mail/bridge
# Make sure Bridge is fully started before Akonadi initializes its mail resources
Before=akonadi_control.service
PartOf=graphical-session.target # does this make a difference?

[Service]
Type=exec
ExecStart=/usr/bin/protonmail-bridge-core --noninteractive
Restart=on-failure
RestartSec=5

[Install]
WantedBy=default.target

```

It’s working as expected so far, but I may experiment further with different service types.
