This sounds like a kmail bug which should be reported to KDE. There is a link under 'help' in Kmail for reporting bugs. Send them the backtrace info if the error generates any.