TechBuzzPro

Auto Delete SMS and Email Codes on iPhone and Mac

· 4 min read · Phones & Tablets

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can automatically delete SMS and email verification codes on iPhone and Mac using built-in features like Messages filtering and Mail rules, reducing clutter and improving privacy. This setup requires iOS 16 or later and macOS Ventura or later, as earlier versions lack the automation needed for auto-deletion. You'll use Message Filtering to move verification codes to a hidden folder and set Mail rules to delete or archive code emails automatically. These steps work across Apple’s ecosystem when signed into the same Apple ID.

What You'll Need

  • An iPhone running iOS 16 or later
  • A Mac running macOS Ventura or later
  • Messages and Mail apps enabled and synced via the same Apple ID
  • Access to email accounts used for verification codes (e.g., Gmail, iCloud, Outlook)
  • Two-factor authentication enabled on accounts that send codes

Step-by-Step

  1. On your iPhone, open Settings > Messages. Make sure iMessage is turned on and your phone number and Apple ID are listed under "Send & Receive."
  2. Tap "Filter Unknown Senders" and turn it on. This moves messages from unrecognized numbers to a separate tab, which helps isolate verification codes often sent from short numbers.
  3. Go to Settings > Notifications > Messages. Scroll down and ensure that previews are set to "When Unlocked" or "Never" to prevent code content from appearing on the lock screen.
  4. On your Mac, open the Mail app. Click Mail > Preferences > Rules. Select "Add Rule" to create a new filtering rule.
  5. Name the rule "Delete Verification Codes" or similar. Under "If any of the following conditions are met," set the first condition to "Subject" "contains" "code" or "verification" or "auth" (add multiple conditions using "or").
  6. Add another condition: "From" "contains" "no-reply@" or "@service.com" (replace with domains like @google.com, @microsoft.com, @apple.com depending on common senders).
  7. Under "Perform the following actions," select "Move message to mailbox" and choose "Trash" or create a "Codes" mailbox and set it to auto-delete after a set time via Mail preferences.
  8. Click "OK" then "Apply." The rule will now run on incoming messages matching the criteria.
  9. To auto-delete SMS codes, open the Messages app on iPhone. Unfortunately, iOS does not support auto-deleting individual messages based on content. However, you can manually delete threads after use or use the "Silence Unknown Senders" feature to reduce visibility.
  10. For partial automation, use Shortcuts on iPhone. Open the Shortcuts app, tap Automation > Create Personal Automation > Message Received. Set trigger to "Message Contains" and enter keywords like "code," "verify," or "authentication." Then add action: "Delete Message." Note: This only works if the message is read and may not catch all codes.
  11. This syncs message history and ensures deletions on one device reflect on the other.
  12. Review your email accounts’ settings to disable sending SMS codes when possible, reducing the number of codes received overall.

Common Mistakes

Users often create overly broad Mail rules that catch legitimate messages, such as newsletters containing the word "code." Avoid using single keywords like "code" alone—combine them with sender domains or message structure. Another mistake is assuming iOS can auto-delete SMS messages natively; it cannot without third-party automation, which has limitations. Some forget to sync iCloud across devices, leading to inconsistent message states. Lastly, turning off iMessage or filtering without backing up important contacts may result in missed messages.

Tips

Use specific keyword combinations in Mail rules—like "verification code" and "noreply"—to increase accuracy. Test rules by sending yourself a sample code email first. On iPhone, mark known code senders as contacts to prevent filtering errors. Use the Shortcuts automation only for critical accounts to minimize false triggers. Regularly review the Trash folder to ensure no valid messages were deleted. Enable two-factor authentication via authenticator apps instead of SMS when possible, reducing code volume altogether.

Troubleshooting

If codes aren’t being filtered, check that the Mail rule conditions match the actual message content—some codes use terms like "security code" or "OTP." Update iOS and macOS to ensure compatibility. If messages aren’t syncing across devices, sign out of iCloud and back in. If Shortcuts automation fails, ensure it’s enabled under Settings > Shortcuts > Allow Untrusted Automations. Restart both devices if rules don’t apply immediately. If messages still appear in the inbox, adjust the rule order in Mail > Preferences > Rules—rules are processed top-down, so prioritize code rules first. If iCloud Messages isn’t syncing, check your internet connection and storage limits.

Frequently Asked Questions

Can I auto-delete SMS codes on iPhone without third-party apps?

No, iOS does not natively support auto-deleting SMS messages. You must manually delete them or use Shortcuts with limited reliability.

Do these methods work for all email providers?

Yes, as long as the email is accessed through the Mac Mail app and the sender uses recognizable keywords or domains in the message.

Will auto-deleting codes break two-factor login?

No, as long as you retrieve the code before deletion. Set rules to delay deletion by a few minutes if needed.

Can I recover a deleted code email?

Yes, if it’s moved to Trash and not permanently deleted. Check Trash within the retention period set in Mail preferences.

Does filtering SMS codes protect my privacy?

Yes, filtering and deleting codes reduces exposure on lock screens and backups, enhancing privacy.

Can I use the same rule for multiple email accounts?

Yes, Mail rules apply across all accounts added to the Mac Mail app unless specified otherwise in the rule conditions.