How to Autofill Security Codes from Mail on Mac, iPhone, iPad

Feb 14, 2024 - 2 Comments

Mail icon for Mac

The latest versions of Mail for iPhone, Mac, and iPad support a fantastic autofill security code feature. This is similar to the autofilling security code feature for SMS that is available in Messages for Mac, iPhone, and iPad, except of course that it’s utilizing the Mail app for two-factor authentication and security codes that are sent to you via email instead of by text message.

The great thing about this trick, other than the incredible convenience it offers, is that autofilling security codes and authentication codes works basically the same on every major Apple device platform, including iPhone, Mac, and iPad.

How to Use Autofill Security Codes from Email on iPhone, Mac, iPad

If you’re using a service that is emailing you a security code or one-time passcode, having autofill retrieve it is very simple.

  1. Open Mail on the Mac, iPhone, or iPad if you haven’t done so already
  2. From Safari, proceed with the website login that required the security code
  3. When Safari detects the security code from Mail, you will see an option to autofill the security code, which you simply click on to automatically fill in. It will look something like this:
  4. How to autofill security codes from Mail on Mac, iPhone, or iPad

  5. Proceed with the authentication using the autofilled security code

This process is basically identical on Mac, iPhone, and iPad.

You will need to be running a modern version of system software, which means macOS Sonoma 14 or newer on Mac, iOS 17 or newer iPhone, or iPadOS 17 or newer for iPad. Earlier versions do not contain the autofill email security code feature, though they do contain the autofill SMS/text message code feature.

It’s important to remember that you must have the email account receiving the security codes setup in Mail app on your device, otherwise this feature won’t work. You can add an email account to Mail on Mac easily, and you can also easily do the same on iPhone or iPad, whether it’s a Gmail, Hotmail, Outlook, Yahoo, AOL, or other email account.

Also, and this isn’t technically necessary, but it’s just what has made the feature always work consistently in my experience; have the Mail app actively running on your Mac, iPhone, or iPad for this feature to work reliably. Again while this is not a technical requirement, it’s just what has consistently worked for me. When I don’t have Mail app running, the autofill feature is not reliable or too slow, and many of the security codes are time limited. Of course your experiences may vary, so you can try either on your own device.

Finally, if you find this feature isn’t working as expected, or the Messages version of security code autofill isn’t working as expected either, you can always use this trick to copy the code quickly, and paste it into the appropriate field yourself. Not nearly as automated, but also simple.

Enjoy this handy feature, and once you learn how it works on one Apple device, you’ll know how to use it on your others as well. Nice, right?


Related articles:

Posted by: Paul Horowitz in iPad, iPhone, Mac OS, Tips & Tricks


» Comments RSS Feed

  1. Sebby says:

    On iOS, you have to use a provider supporting push, otherwise the code won’t be found automatically. Apple really needs to document their push protocol, otherwise it’s basically just iCloud and Exchange.

  2. Meherally says:

    One important caveat, it works only in Safari. If one is using any other browser the autofill does not work, unless there is a way to have Mac Mail and Messages ‘talk’ to the browser.

Leave a Reply


Shop on and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site