I want to apologize for some mistake in official mail and want to make them sure I will not do that again.
"I will take care of this next time" .
or
"I will take care of this onwards".
Steve's suggestion is the best, but if you want to apologise in a more formal way, then: I deeply regret what occurred, and I promise that I will make every effort and do everything in my power to prevent its reoccurrence. (Very formal)
Suitable for many situations where you realize you have made an awful blunder.
This could be said to a family member or a friend when you need to express contrition. You can forgo the second sentence.
Terse and very formal, perhaps more appropriate in a business environment.