In every criminal prosecution for libel it shall be lawful for the defendant, upon the trial, to give in evidence the truth of the matter written or published, and if it shall appear to the jury that the matter charged as libelous is true, and was published with good motives and for justifiable ends, the defendant shall be acquitted.