Bug 390733 - KMail cannot send mails using gmail smtp
Summary: KMail cannot send mails using gmail smtp
Status: CONFIRMED
Alias: None
Product: kmail2
Classification: Applications
Component: general (show other bugs)
Version: Git (master)
Platform: Neon Linux
: NOR critical
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-19 14:48 UTC by Tom Kijas
Modified: 2023-07-07 06:25 UTC (History)
11 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Kijas 2018-02-19 14:48:55 UTC
I used Kmail with our gmail (google account on my domain) without problems for 2 years.

Now, on 3 my computers, it says "server error" when trying to send email.

Downloading emails using IMAP works properly

Sending them is not possible. SMTP is set-up properly.

Terrible situation as all computers in our company use KMail.
Comment 1 Tom Kijas 2018-02-19 14:49:55 UTC
UFW is set-up to let the proper ports opened and of course can be disabled - without difference.
Comment 2 Tom Kijas 2018-02-19 14:53:12 UTC
It's because two-factor authenticator is in use. WORKAROUND is to generate app-specific password. Why? Why cannot it use the same way to login as IMAP?
Comment 3 DeMus 2018-02-26 17:49:37 UTC
Same here. I have 1 POP and 1 IMAP account in KMail but sending from both accounts is not possible. Mail just stays in the outbox folder.
I also setup the 2-step verification (at the moment just for the IMAP account) but doesn't make a difference. I was hoping through more security it would work, but no. I can not send mails at all now.
Comment 4 DeMus 2018-02-26 17:53:15 UTC
(In reply to DeMus from comment #3)
> Same here. I have 1 POP and 1 IMAP account in KMail but sending from both
> accounts is not possible. Mail just stays in the outbox folder.
> I also setup the 2-step verification (at the moment just for the IMAP
> account) but doesn't make a difference. I was hoping through more security
> it would work, but no. I can not send mails at all now.

Forgot to mention:
I'm using Manjaro Linux 17.1.6 Hakoila - Testing, with Plasmashell 5.12.2, Kontact 5.7.2
Comment 5 DeMus 2018-02-27 14:46:48 UTC
The problems with KMail not being able to send mails using a Gmail account are as old as January 2007. I found message on the Kubuntu forum from that date. This means for 11 years already people around the world are having these problems. Why other e-mail clients can do this and KMail can not? 
Did the KDE developers working on KMail (Kontact) ever discussed the matter with Google to come to a solution? If not, why not and isn't it time to do so?
Comment 6 DeMus 2018-02-28 12:53:26 UTC
Message I get is:

E-Mail Sending Failed

Failed to transport message. Connection timed out Failed to store result in item. Item query returned empty result set 

Is there a way to setup a time-out somewhere? Google says:
Server timeouts	Greater than 1 minute (5 is recommended)
Comment 7 Shmerl 2018-07-06 18:45:14 UTC
I have this problem on a newly set up system, and older system with same Kmail that was setup in in the past with exactly same settings works just fine. I *don't* have two factor authentication enabled.

Really weird, and it seems to be a bug in Kmail account setup itself, since older installation works fine.
Comment 8 Axel Braun 2018-09-08 12:37:37 UTC
I just ran into a similar problem (kmail 5.9.0) as the mail account hosted on gmail suddenly turned red and did not update with new mail.

As it was an IMAP account, I deleted the local account and recreated it. Still it did not update. Solution: changed the account authentification method from Gmail to Plain. Now mails can be retrieved again!
Comment 9 Tom Kijas 2018-10-25 06:17:36 UTC
Now it is similar, but this time, KMail doesn't even tell me there is an error, the mail simply hangs in Outgoing folder!
That's so unprofessional...

Je tu někdo, s kým by se dalo na vyřešení problému pracovat?
Comment 10 Tom Kijas 2018-11-06 12:35:53 UTC
Same problem on both Google and Exchange account.
Comment 11 Christophe Marin 2018-11-06 13:10:53 UTC
Please specify:
- Your kdepim-runtime version,
- your libkgapi version,
- your KMail version
Comment 12 Tom Kijas 2018-11-06 22:03:02 UTC
Yes, my apology.
kdepim: 17.08.3
kdepim-runtime: 18.08.2
libkgapi: 18.08.2
Kmail: 5.7.2

I am the person who reported this bug.

The point is, it works for some time (hour or two, 3 or 4 emails sent), then, no matter if using GMail or Exchange, it just stops to send them.

In the most of the time the emails stays in Outgoing folder, rarely it says "item query returned empty result set kmail"

It happens on 3 computers I use.
Comment 13 Christoph Feck 2018-11-06 23:33:25 UTC
Those versions look like an unsupported mix of various KDEPIM versions. Please stick to a single version. The following table might help to associate KDEPIM versions with KDE Applications releases:

5.9.x   18.08.x
5.8.x   18.04.x
5.7.x   17.12.x
5.6.x   17.08.x
Comment 14 Michael D 2018-11-21 11:56:49 UTC
I recently started getting this issue as well on Manjaro testing running kmail 5.9.3, kdepim and kdepim-runtime versions 18.08.3-1. I can receive emails from my gmail account just fine using imap, but I cannot send emails. It used to work not that long ago.
Comment 15 Michael D 2018-11-23 13:08:59 UTC
After switching to two-factor authentication and generating an app-specific password from google, I was able to receive and send emails once I set in kmail authentication to "plain" instead of "gmail".
Comment 16 Tom Kijas 2019-02-06 12:00:58 UTC
The bug still exists in brand new installations of KDE Neon/KMail.
"Item query returned empty result set kmail..."
KDE Frameworks 5.54.0
Qt 5.11.2 (sestaveno oproti 5.11.2)
xcb okenního systému

Brand new installation of KDE Neon:

KDEPIM 18.12.1
KDEPIM Runtime 18.12.1
KMail package 18.12.1
Comment 17 Tom Kijas 2019-06-24 11:33:09 UTC
KDE 5.16.1 the bug still exists, KMail is still unusable with GMail (google apps) account.
Comment 18 Axel Braun 2019-06-29 14:58:41 UTC
(In reply to Tom Kijas from comment #17)
> KDE 5.16.1 the bug still exists, KMail is still unusable with GMail (google
> apps) account.

I'm running KMail 5.11.2 and have no issues sending via smtp.gmail.com
Comment 19 Tom Kijas 2019-07-24 09:43:15 UTC
Axel Braun: Ok, do you use 2AUTH? Is it Google Apps email (on your domain)?
It seems to be problem in Akonadi, it crashes and has to be restarted.
Bugs #345979 and mainly #395846 seems to be related.
Comment 20 Axel Braun 2019-07-25 06:30:41 UTC
(In reply to Tom Kijas from comment #19)
> Axel Braun: Ok, do you use 2AUTH? 

Good question - I dont know. I gues KMail does the required setup at the first login/Sendmail. It is just configured as SMTP

> Is it Google Apps email (on your domain)?

Yes, its an external domain hosted by gmail
Comment 21 Tim Wright 2021-11-06 20:56:28 UTC
I've encountered the exact same problem: cannot sent SMTP mail from KMail to a Google GMail account. It just stays in the outbox, no error messages or status. Receiving POP mail works fine. My KMail was sending fine, then no more.  I'm running KMail 5.14.2 (20.04.2) KDE Frameworks 5.71.0 and Qt 5.12.7 (built against 5.12.7)
Last activity on this bug was July 2019. Has anything come out of this?
Comment 22 Lukas Ba. 2022-02-26 20:32:23 UTC
Works fine for me. I will describe my setup here. For the sake of a minimal test i just setup a sending account with SNMP and no receiving account.

Google
I enabled two factor authentication in Google settings, and there i obtained an app specific password for App Email.

Kmail
In the accounts settings:
I have an identity setup, and in that, in advanced i refer to my outgoing account.
In Receiving, i do not have setup any Incoming account.
In Sending have setup up a outgoing account of type SMTP...

... detailed settings below:
General tab
outgoing mailserver: smtp.gmail.com
Server requires authentication: Yes / checked
User: usermyname@gmail.com
Password: My application specific password
Store SMTP Password: Yes / checked

Advanced tab
Connection settings:
Encryption: STARTTLS
Port: 587
Authentication: Plain

SMTP settings:
Here every box is empty or set to no / not checked
Comment 23 Lukas Ba. 2022-02-26 20:52:45 UTC
(In reply to DeMus from comment #3)
> Same here. I have 1 POP and 1 IMAP account in KMail but sending from both
> accounts is not possible. 

POP3 and IMAP are protocols for receiving emails, not for sending emails. Only SMTP supports sending emails. So what you are saying is not a bug.
Comment 24 jakub.kuzniar 2022-06-09 17:09:50 UTC
From 30th of May, google does not allow for "Less secure apps" meaning sending the emails via stmp using as login email and account password is not allowed. Method described above using application passwords is working, but is not recommended by google. And is also little problematic for not aware end user. As described in the google help modern applications use some other methods to get access to the gmail. Therefore kmail will need to follow this in feature.
Comment 25 jshand2013 2022-11-13 08:04:10 UTC
this issue seems to be present in the most recent version
Comment 26 ybx332 2023-07-07 04:25:26 UTC
I found a workround is to set the SMTP verification method to XOAUTH2 and use the same password as you login password. I didn't enable two-factor authentication.
Comment 27 jshand2013 2023-07-07 06:25:45 UTC
(In reply to ybx332 from comment #26)
> I found a workround is to set the SMTP verification method to XOAUTH2 and
> use the same password as you login password. I didn't enable two-factor
> authentication.

i got this working quite a while back now, early 2022.  thanks for your reply.  this is now a default setting with kmail