Depends on the platform, but generally speaking it requires taking whatever action changes its status from "unread" to "read." But even then, there has been at least one case of iOS malware that infected the system upon delivery of a text (since BlastDoor parsed the payload upon receipt, IIRC). That's one reason why Lockdown Mode rejects any text from unknown numbers.