Skip to content

Function: codeEmailSubject()

codeEmailSubject(code, subject): string

The SUBJECT line, with the code in it: "123456 is your verification code".

The code has to be here, not only in the body, because of what mobile autofill actually reads. iOS offers a code from an incoming NOTIFICATION - natively for Messages and Mail, and since iOS 26 for any app’s notification text, which is what finally made Gmail work - and a notification contains the sender, the subject, and a short snippet. Nothing else. A code that lives in the body is invisible to it, however cleanly the body is formatted, which is why a perfectly shaped text/plain part still produced no autofill prompt in Gmail.

<code> is your <thing> rather than <thing>: <code> because the leading code survives TRUNCATION: a notification and an inbox list both cut the subject, and the platform heuristics want the code in the same sentence as a recognized prompt (“code”, “verification”). Putting it first keeps both intact no matter where the cut lands.

subject is the configured line (“Your verification code”), lower-cased at its first word so the sentence reads naturally, and left ALONE when it does not look like the conventional phrasing - an operator who set a deliberate subject gets theirs with the code prefixed, not a mangled hybrid.

string

string

string