Is Divorce in Writing Valid?
Question

If a husband writes a text message to his wife on the cell phone, saying “You are divorced” then he says that he did not mean it as a divorce, does that count as a divorce?
Praise be to Allah.If the husband writes a message to his wife saying “You are divorced,” whether that is via a mobile phone or on a piece of paper or via email , then it depends on his intention at the time of writing. If he was determined to divorce her, then it counts as a divorce, but if he wrote that without the intention of divorce , rather he wanted to make his wife upset or some other reason, then it does not count as a divorce. 
Ibn Qudamah (may Allah have mercy on him) said: 
“Divorce does not take place if the word of divorce is not uttered , except in two cases, one of which is when a person is unable to speak, such as a man who is mute; if he issues a divorce by means of gestures, then his wife is divorced. 
The second case is if the divorce is written; if he intended it as such then his wife is divorced. This is the view of Ash-Sha`bi, An-Nakha`i, Az-Zuhri, Al-Hakam, Abu Hanifah and Malik, and it is the view that is narrated from Ash-Shafi`i. 
If a man writes it without intending divorce , then it does not count as such according to the majority of scholars, because writing is open to interpretation, and he may have intended just to test the pen, or improve his handwriting, or upset his wife, without intending it (as a divorce).” (Al-Mughni, 7/373)
It says in Matalib Uli An-Nuha (5/346): “If the one who wrote the words of divorce says: I only intended to improve my handwriting thereby, or I only intended to upset my wife, that is to be accepted, because he knows best what his intention was, and he intended something that may be interpreted as other than divorce… and if he intended to upset his wife by making her think that he was divorcing her when in fact that was not the case, then he was not intending to divorce her.”
Shaykh Ibn Baz (may Allah have mercy on him) was asked: A man was sitting with his sister and his wife and he asked his sister to bring him a pen, then he wrote on a paper: “Talaq, talaq (divorce, divorce)” without referring to anybody. His sister got angry and took the pen, then she wrote three times, talaq, talaq, talaq (divorce, divorce, divorce).” Then she threw the paper to his wife and said to her: “Look, is what I have written correct?” But he did not intend to write these words for his wife. 
He replied: 
“This divorce does not count as such for the wife mentioned, if he did not intend thereby to divorce her. Rather he was simply writing or he intended something other than divorce, because the Prophet (peace and blessings of Allah be upon him) said: “Actions are but by intentions…” 
This view was held by a large number of the scholars and some of them narrated that it was the view of the majority, because writing is like a metaphor, and a metaphor does not count as a divorce unless it is intended as such, according to the more correct of the two scholarly opinions, unless the writing is accompanied by evidence that the intention was divorce, in which case it counts as such. 
In the incident mentioned, there is nothing to indicate that the intention was divorce, so the marriage remains as it is, and actions are judged by intentions.”
Shaykh Muhammad ibn Ibrahim (may Allah have mercy on him) said: 
“We have received your question, from which we understand that a man wrote one divorce to his wife So and so the daughter of So and so, and that he added his signature and name to the writing, but he did not intend thereby to divorce his wife at all. Rather he wrote the paper to scare his wife and threaten her so that she would stop treating her husband badly. You are asking whether this man’s divorce of his wife counts as such or not.
The answer: Praise be to Allah. If the matter is as described, and by clearly writing words of divorce to his wife he did not intend anything other than to threaten her and scare her so that she would stop treating him badly, and he did not intend divorce at all, then this does not count as a divorce. And Allah is the source of strength.” (Fatawa Muhammad ibn Ibrahim, 11/ question no. 3051)
Shaykh Muhammad ibn Ibrahim (may Allah have mercy on him) was also asked about a man who wrote words of divorce to his wife, intending thereby to upset his wife and threaten her. 
He replied: 
“It seems to us that this divorce does not count as such, rather he intended thereby to upset his wife and threaten her. The scholars have stated that if he intended by writing the words of divorce to improve his handwriting or upset his family, then his intention is to be accepted and the divorce does not count as such. It says in Sharh Zad Al-Mustaqni` (vol. 3 p. 150): If a man clearly writes the word of divorce to his wife in such a way that it appears clear, it counts as a divorce even if he did not intend it as such, because it is clearly stated. However, if he says, ‘I only intended to improve my handwriting or to upset my family,’ then it should be accepted (from him).” End quote. 
And Allah is the source of strength.” (Fatawa Muhammad ibn Ibrahim, 11/question no. 3050)
And Allah knows best.