Any person bound as surety or accommodation indorser for another, may, at any time after the debt has become due or liability been incurred, give notice in writing to the creditor to commence and prosecute legal proceedings against the principal debtor, if living and resident within this state, for the recovery of the debt; and if the creditor fails to commence legal proceedings by the next term of the court in which the same shall be instituted, to be held after the expiration of thirty (30) days from the giving of the notice, and to prosecute the same to effect, the surety who shall have given the notice shall be discharged from liability. It shall not be lawful to plead or to give in evidence under this section a notice not in writing, and any act of the creditor shall not be a waiver of notice in writing as herein required.