Praise be to Allah.
We put this question to Shaykh Muhammad ibn Saalih al-‘Uthaymeen, may Allaah preserve him, who answered as follows:
He should not swear an oath to give up smoking, or pray for himself to be cursed. Allaah says (interpretation of the meaning):
“They swear by Allaah their strongest oaths, that if only you would order them, they would leave (their homes for fighting in Allaah’s Cause). Say: ‘Swear you not; (this) obedience (of yours) is known (to be false). Verily, Allaah knows well what you do.’” [al-Noor 24:53]
Question: But this [aayah] has to do with the munaafiqeen (hypocrites), and our friend is sincere.
Answer: This [ayah] is general [in meaning]. Every person who wants to worship Allaah should not swear an oath concerning his worship; let him strive of his own free will, not under compulsion.
Question: so this way is wrong and he will be sinning if he does it?
Answer: No, what is denounceable is the fact that he is trying to confirm something through this oath.
Question: So we can say that this is an action which is not prescribed in Islam?
Answer: Yes, undoubtedly. And Allaah knows best.