The first step is to log in to your GMail account and to click on Settings and click on the Forwarding and POP tab. Under POP Download select Enable POP for all mail and click Save Changes.
Log out of GMail and go to your UBUNTU or Linux install.
If you have not used Evolution before, or haven’t set up an account the New Account Wizard will launch. Click Forward.
Type in your Full Name and your Gmail Email Address and click Forawrd.
Select SMTP as the Server Type. The Server is smtp.gmail.com. Encryption is TLS, Authentication is Plain and fill in your full Gmail Email Address. Click Forward.
Give your account a name, it does not have to be anything Logical. Click Forward.
Select the current Time Zone and click Forward.
If the New Account Wizard doesn’t launch, then in Evolution go to Edit – Preferences and click on Mail Accounts. Edit the info so that it matches the information above and you will be able to send and receive GMail.
Select “File,” “New,” Account, the New Account Wizard will launch. On the window that pops up select “email account,” and next.
Then type in your name in the top box, and your full GMail email address in the bottom, and click next.
On the next window select “POP” as the type of incoming server, then name the incoming server “pop.gmail.com”.
It doesn't matter if “Use Global Inbox is enabled” is checked, it makes all of your email accounts report to the same inbox, check it or uncheck it as you wish, and click next.
After that make your user name is the same as your email address and click next
Then type in an account name (eg: inbox, gmail, home) this is what you click on to access this account and can be whatever you want, and click next.
Next click on Edit -- Account Settings in Thunderbird and from the menu of the new window select “server settings.” Click SSL and the port will automatically switch to 995.
Click on Outgoing Server (SMTP) and specify smtp.gmail.com as the outgoing mail server, and select SSL as the encryption and the port will automatically switch to 465. Type in your full GMail email address and click ok.
Go to “Settings,” then “Configure Kmail”
Click on accounts
Select POP3 on the window that pops up and OK
On this window type in whatever you want your account to be called under “Account Name.” Then type your login, which is your entire email address, and your password. Next for the host type in “pop.gmail.com,” and change the port to 950. Change the rest of the settings to your liking.
Then on the top tab, arrow over to “Extras” For encryption select “Use ssl for secure mail download,” and for Authentication Method, select “Clear Text.”
Here's how to configure gmail outbound in Kmail.
Go to settings, configure kmail
Go to accounts and sending
Go to add, on the box that pops up select smtp and OK
The host is smtp.gmail.com
The port is 465
Check the box that says server requires authentication
*Your login is your email address (with the @gmail.com at the end)
Type your password
Go to security and check the ssl box.
Click OK, then apply
Go to identities, click modify, and type in your email address.
You can find the full article with screenshots here