IMAP and SMTP settings for Gmail, iCloud and Yahoo
The IMAP and SMTP servers, ports and security settings for Gmail, iCloud Mail and Yahoo Mail in one table, and why your normal password is refused.
Sanjeev Maharjan5 min read

Gmail, iCloud Mail and Yahoo Mail all receive mail over IMAP on port 993 with SSL/TLS. They differ on sending: Gmail and Yahoo accept SMTP on port 465 or 587, and iCloud uses 587. All three expect an app password in a mail app that does not show the provider's own sign-in window.
The short version: incoming is imap.gmail.com, imap.mail.me.com or imap.mail.yahoo.com, always port 993. Outgoing is smtp.gmail.com, smtp.mail.me.com or smtp.mail.yahoo.com. The password is an app password, not the one you use on the website.
The settings in one table
These are the values each company publishes for other mail apps.
| Setting | Gmail | iCloud Mail | Yahoo Mail |
|---|---|---|---|
| IMAP server | imap.gmail.com | imap.mail.me.com | imap.mail.yahoo.com |
| IMAP port | 993 | 993 | 993 |
| IMAP security | SSL/TLS | SSL/TLS | SSL/TLS |
| SMTP server | smtp.gmail.com | smtp.mail.me.com | smtp.mail.yahoo.com |
| SMTP port | 465 or 587 | 587 | 465 or 587 |
| SMTP security | SSL/TLS on 465, STARTTLS on 587 | STARTTLS on 587 | SSL/TLS on 465, STARTTLS on 587 |
| Username | Full address | Name part for IMAP, full address for SMTP | Full address |
| Password | App password | App-specific password | App password |
The sources are Google's page on adding Gmail to another email client, Apple's iCloud Mail server settings and Yahoo's IMAP server settings for Yahoo Mail.
What IMAP and SMTP are
They are two separate connections that do two separate jobs, which is why a mail app asks for two servers.
- IMAP is for reading. Your mail stays on the provider's server, and the app shows you a copy and keeps it in step. Read a message on your Mac and it is marked read on your phone.
- SMTP is for sending. The app hands your message to the provider's outgoing server, which delivers it.
Because they are separate, one can work while the other fails. "I can read but not send" is nearly always a wrong SMTP port, security type or password, not a problem with the account.
Which port and security type to choose
Port 993 for IMAP is encrypted from the first byte. For SMTP there are two encrypted options. Port 465 is also encrypted from the start, usually labelled SSL or SSL/TLS. Port 587 starts as a plain connection and upgrades to an encrypted one before anything is sent, labelled STARTTLS. Pick the pair your provider lists, and never choose "None".
Why your normal password is refused
The most common failure has nothing to do with servers or ports. The servers above reject the password you use on the website.
- Gmail: Google expects either its "Sign in with Google" window or an app password. Google says app passwords can only be used on accounts with 2-Step Verification turned on.
- iCloud: Apple requires an app-specific password for third-party apps, and says the Apple Account must be protected with two-factor authentication.
- Yahoo: Yahoo says third-party email apps that do not use its own sign-in page need an app password.
An app password is a long, random password the provider makes for one app. You paste it where the app asks for a password, and you can remove it later without changing anything else.
There are step by step guides for two of them: creating a Gmail app password for a Mac mail app and creating an iCloud Mail app-specific password.
How to create a Yahoo app password
Yahoo's instructions are short.
- Sign in to the Yahoo Account Security page in a browser.
- Under "External connections", select Create app password.
- Follow the prompts, and give it a name that tells you which app it is for.
- Copy the password Yahoo shows and paste it into your mail app.
Yahoo adds two points worth knowing. It recommends creating the password in a browser you have already used to sign in to Yahoo for several days, and not in a private window. And it says app passwords stay active even if you change your main Yahoo password: to stop one working, you delete it. The details are on Yahoo's page about generating and managing third-party app passwords.
If it still will not connect
- Check the username. For Gmail and Yahoo it is the whole address. For iCloud, try the name part for incoming mail and the full address for outgoing.
- Paste the app password again. A space at the end is easy to pick up when copying.
- Match the port to the security type: 465 with SSL/TLS, 587 with STARTTLS.
- If you changed your Google or Apple password recently, make a new app password. Both companies revoke the old ones when you do.
How Mailvie handles these settings
In Mailvie you do not type these servers for Gmail, iCloud or Yahoo. You pick the service on the Add an account screen and enter your email address, the app password and a name for the sidebar. The screen has a button that opens the provider's password page. For any other mail service, you choose "Other mail" and enter the incoming IMAP server and port your host gives you.
Two honest limits in version 0.1.0. Gmail signs in with an app password, because the "Sign in with Google" window is not built yet. And Mailvie sends over port 465 only, so sending from an iCloud account is not available yet, although reading it is.
Passwords are stored in the macOS Keychain and go only to your mail provider. Mailvie runs no server of its own for mail: see the connections Mailvie makes. Reading and search are free, and sending needs one of Mailvie's plans. It runs on Apple Silicon Macs with macOS 14 or later, and you can download Mailvie for Mac to try it.
Questions people ask
Should I use port 465 or 587 for sending?
Use whichever your provider lists, with the matching security type: SSL/TLS on 465, STARTTLS on 587. Gmail and Yahoo accept both. Apple lists only 587 for iCloud Mail. Both ports encrypt the connection before your password is sent.
Why does my mail app say the password is wrong when it is right?
Because the server wants an app password, not the one you use on the website. Gmail, iCloud and Yahoo all refuse the normal password from an app that does not show their own sign-in window. Create an app password and use that.
Is IMAP better than POP?
For most people, yes. IMAP keeps mail on the server and keeps every device in step, so what you read or delete on one shows on the others. POP downloads mail to one device and was designed for a time when people had only one.
Written by Sanjeev Maharjan
Sanjeev Maharjan builds Mailvie, a mail app for the Mac. Found a mistake in this guide? Write to [email protected].