By mistake - по ошибке, нечаянно, случайно, по неосторожности
By mistake means by accident.
I sent that message to James by mistake.