No, it's not illegal, but it violates the privacy of the person. So, before taking screenshots, please consider twice and take consent from the sender.