It is illegal. Complaint can be filed against the said person for the offence of defamation. Both civil as well as criminal defamation case can be filed simultaneously. According to section 499 of IPC, whoever, by words either spoken or intended to be read, or by signs or by visible representations, makes or publishes any imputation concerning any person intending to harm, or knowing or having reason to believe that such imputation will harm, the reputation of such person, is said, except in the cases hereinafter expected, to defame that person. Maximum punishment for the offence of criminal defamation is 2 years. In a civil defamation case, a person who is defamed can move court and seek damages in the form of monetary compensation.
Also, complaint can be filed with the police under the provisions of section 66 if IT Act.