When adding a new GMail account an OAuth2 window pops up and everything works as expected. However the SMTP authentication settings have Authentication set to PLAIN, which does not work. Setting this to XOAUTH2 solves the issue. So the bug seems that KMail seems to set PLAIN authentication by default even when an OAuth2 authentication method was used to add the account. How to manually fix the issue: Configure KMail -> Accounts -> Sending -> Select Google Mail SMTP -> Modify... -> Advanced -> Change "Authentication" from PLAIN to XOAUTH STEPS TO REPRODUCE 1. Configure KMail -> Accounts -> Receiving -> Add... -> Add Mail account -> *follow wizard* 2. Try to send an email, which fires a warning email from google an does not work. OBSERVED RESULT Email does not send via SMTP because Google Mail does not let plain authentication to send emails by default. EXPECTED RESULT SMTP authenticates via OAuth2 by default if that what's been used to add the account, so sending mail works. SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 5.23.2 KDE Frameworks Version: 5.87.0 Qt Version: 5.15.2 Kernel Version: 5.14.16-zen1-1-zen (64-bit) Graphics Platform: X11 Processors: 8 × 11th Gen Intel® Core™ i7-1165G7 @ 2.80GHz Memory: 15,4 GiB of RAM Graphics Processor: Mesa Intel® Xe Graphics
I've made a merge request to fix this: https://invent.kde.org/pim/kmail-account-wizard/-/merge_requests/7 (earlier it was hardcoded to do oauth only for imap)
A possibly relevant merge request was started @ https://invent.kde.org/pim/kmail-account-wizard/-/merge_requests/7
Git commit 55fd9363563676ccdfe9ea62cc173b095841e33b by Kishore Gopalakrishnan. Committed on 11/06/2022 at 16:02. Pushed by mlaurent into branch 'master'. Allow oauth2 for non-imap as well At least for smtp, it is apparently supported. M +1 -1 src/ispdb/ispdb.cpp https://invent.kde.org/pim/kmail-account-wizard/commit/55fd9363563676ccdfe9ea62cc173b095841e33b