By default, OS X Mail stores junk mail on your computer. iCloud Mail stores all messages on an IMAP server. If you want to keep the contents of both folders the same between iCloud Mail and OS X Mail, follow these steps:
- Open the Mail app on your Mac.
- Choose Mail > Preferences.
- Click Junk Mail, then select “Enable junk mail filtering” and “Move it to the Junk mailbox”:
- Click Accounts.
- Select your iCloud email account on the left.
- Click Mailbox Behaviors, then select Store junk messages on the server.
With these settings, all messages marked as junk are stored on the iCloud server, and you can see them in the Junk folders of both OS X Mail and iCloud Mail. As a result, when you delete a message from either folder, the message is deleted permanently.
Junk mail on the iCloud server counts toward your iCloud storage limit, so you might want to delete junk messages as soon as you're sure they're junk. Messages in the Junk folder are deleted automatically when they are more than 30 days old.