This tutorial explains how to setup KMail for Gmail in SMTP mode. You will first enable SMTP support from web Gmail (using browser) and then setup SMTP account on KMail. This article is a pair of the POP3's one. I use KMail version 5.4.1 for this article.

Why IMAP?

You can read what's the difference between POP and IMAP from here or here. IMAP is most suitable when you have multiple devices (laptop & phone). You can think it's similar to Telegram where you can have different devices but same contents, and deleting data from one device means deleting on all devices.