Article 596 [source]

Spanish Criminal Code
English translation

1. Anyone who, in time of war and with the intent to compromise the peace, security, or independence of the State, corresponds with an enemy country or one occupied by its troops when the Government has prohibited it, shall be punished with imprisonment for one to five years. If the correspondence contains warnings or information that could be used by the enemy, the penalty shall be imprisonment for eight to fifteen years.

2. The same penalties shall apply to anyone who commits the crimes covered by this article, even if the correspondence is sent through a friendly or neutral country to evade the law.

3. If the offender intends to serve the enemy with their warnings or information, they shall be considered to fall under paragraph 3 or paragraph 4 of Article 583.