How to get sign-in codes on a Mac without opening the email
Three ways to copy a verification code from email on a Mac without opening the message, from Safari's autofill to a mail app that copies it for you.
Short answer: on macOS Sonoma or later, keep the account in Apple Mail and Safari will offer the code (“From Mail”) when you click the code field. If you use another browser, or want it to work for every app, Glassmail copies the code to your clipboard the moment the email arrives, so you just press ⌘V. For sites you use a lot, switch to an authenticator in the Passwords app and skip email codes altogether.
1. Safari’s autofill from Mail (built in)
You need: macOS Sonoma or later, the account added to Apple’s Mail app, and Mail running.
- On the website, click the code field.
- When the email arrives, Safari shows a suggestion like “From Mail: 123456”. Click it.
- To clean up, open System Settings › General › AutoFill & Passwords and turn on Delete After Use under Verification Codes.
Limits: it works best in Safari, only for accounts in Apple Mail, and people report it’s slow when Mail is closed. Codes expire fast, so a slow suggestion means typing it anyway.
2. Read the code in the notification
In System Settings › Notifications › Mail, choose Banners and set Show Previews to Always. The code appears in the notification when the email arrives. You still have to read it and type it.
3. A mail app that copies the code for you
Glassmail looks for sign-in codes as mail arrives, in every account:
- The code is copied the moment its email arrives, ready to paste with ⌘V in any browser or app.
- Codes that still work show above the inbox with a Copy button, and in the list with a Copy Code button, so you never open the email.
- From the notch: new mail appears under the MacBook notch (or the menu bar) with Copy Code, Archive and Delete, without bringing Glassmail forward.
- Then it’s gone: delete or archive the code email from the notification or the list, and undo if you change your mind.
Glassmail works with Gmail, iCloud, Outlook, Yahoo, Fastmail and any IMAP account. It’s free for 14 days, then $49 once. Disclosure: Glassmail is our app.
4. Skip email codes
Email codes are the weakest kind of two-step sign-in. Where a site lets you, switch to a passkey or an authenticator app. The Passwords app on your Mac can hold authenticator codes and fill them in Safari, so there’s no email to wait for.
More: inbox zero on a Mac and all your email accounts in one app.
Quick answers
How do I autofill email verification codes on a Mac?
Add the email account to Apple's Mail app and keep Mail running. When a site in Safari asks for a code, click the code field and choose the suggestion "From Mail". It works on macOS Sonoma and later, best in Safari.
Can a Mac delete verification code emails automatically?
Yes. In System Settings › General › AutoFill & Passwords, turn on Delete After Use under Verification Codes. Code emails are deleted after Safari fills them in.
Is there a Mac email app that copies sign-in codes for you?
Glassmail copies a sign-in code to the clipboard the moment its email arrives, and shows codes that still work above the inbox with a Copy button. It works in any browser or app, and with every account, not only ones in Apple Mail.