(a) In this section:
(1) “Electronic communication,” “user,” and “wire communication” have the meanings assigned by Article 18A.001, Code of Criminal Procedure.
(2) “Electronic storage” has the meaning assigned by Article 18B.001, Code of Criminal Procedure.
(b) A person commits an offense if the person obtains, alters, or prevents authorized access to a wire or electronic communication while the communication is in electronic storage by:
(1) intentionally obtaining access without authorization to a facility through which a wire or electronic communications service is provided; or
(2) intentionally exceeding an authorization for access to a facility through which a wire or electronic communications service is provided.
(c) Except as provided by Subsection (d), an offense under Subsection (b) is a Class A misdemeanor.
(d) If committed to obtain a benefit or to harm another, an offense is a state jail felony.
(e) It is an affirmative defense to prosecution under Subsection (b) that the conduct was authorized by:
(1) the provider of the wire or electronic communications service;
(2) the user of the wire or electronic communications service;
(3) the addressee or intended recipient of the wire or electronic communication; or
(4) Chapter 18B, Code of Criminal Procedure.