Navigate to Account Settings > Email Settings:
Incoming Email (Email Account:)
Server name: imap.mail.me.com
Port: 993
SSL required: Yes
Username: Your full iCloud email address (e.g. exampleperson@icloud.com or exampleperson@me.com)If your email client does not allow you to enter the full iCloud email address or you can't connect to iCloud using the full address, try using just the name part of your iCloud email address ("exampleperson" in the above examples).
Password: an application-specific iCloud Mail password (Starting June 15, 2017, you need to enable an App-Specific Password for your iCloud account)
Outgoing Email
Server name: smtp.mail.me.com
Port: 587 with SSL (or without)
OR
Port 465 with SSL (or without)
OR
Port 25 with SSL (or without)
Username: Your full iCloud email address (e.g. exampleperson@icloud.com or exampleperson@me.com, not just exampleperson)
Password: an application-specific iCloud Mail password (Use the application password you created for your incoming email connection above)