Criminal harassment
264. (1) No person shall, without lawful authority and knowing that another person is harassed or recklessly as to whether the other person is harassed, engage in conduct referred to in subsection (2) that causes that other person reasonably, in all the circumstances, to fear for their safety or the safety of anyone known to them.
...Punishment
(3) Every person who contravenes this section is guilty of

(a) an indictable offence and is liable to imprisonment for a term not exceeding ten years; or

(b) an offence punishable on summary conviction.

Factors to be considered
(4) Where a person is convicted of an offence under this section, the court imposing the sentence on the person shall consider as an aggravating factor that, at the time the offence was committed, the person contravened

(a) the terms or conditions of an order made pursuant to section 161 or a recognizance entered into pursuant to section 810, 810.1 or 810.2; or

(b) the terms or conditions of any other order or recognizance made or entered into under the common law or a provision of this or any other Act of Parliament or of a province that is similar in effect to an order or recognizance referred to in paragraph (a).