Your cancellation will be in effect on the date that you leave.
Please provide proof of deregistration (not only from the University, but from the official side) from Germany, so called "Abmeldebescheinigung" (Letter of Deregistration).
You should also note that the 3 months period will at earliest start from the date that you leave Germany, even if you send your cancellation earlier - so you have to pay for additional 3 months after leaving Germany (according to telecommunications act)