The author - may Allah be pleased with him - said in his Book, Riyaad as-Saaliheen, “What the Individual Should Say When Served Food In a Feast While Fasting and Not Intending to Break the Fast.”
He then mentioned the hadeeth of Aboo Hurayrah - may Allah be pleased with him - that the Prophet ﷺ said concerning the individual invited to a meal while he is fasting that, “If he was fasting, he should supplicate but if he is not fasting, he should partake.”
Fal yusalli (as it occurs in the Arabic text, rendered as he should supplicate), means, “he should pray” considering the fact that the word, Salaat (the verbal noun form of the verb, salli) here means “supplication” as in the Arabic lexicon that the word, Salaat means, supplication. However, in the technical sense, Salaat refers to the well-known worship except when evidence indicates that what is intended is supplication; then, it will be so taken.
So if the individual is invited for a meal and he attends, his attendance alone does not suffice, he should partake in the meal, since the person who gave the invitation did that purposely that you may partake. He had gone extra mile for you and prepared food more than his family needs and invited you to it. So if we say, “don’t eat” or that, “there is no blame on you if you choose to leave the food”; that will necessarily mean that his food will remain not eaten.
If - for instance -, he invited ten persons, and we hold that attending is obligatory even though one does not partake in the meal, and they all leave without taking the meal. Or he presented the food and said, “Kindly come on” and they do not, that will imply wastage of his
resources and he begins to wish the attendees ill (wondering): "Why have they refused to take my meal?!"
So we say: If a person invites you, the guidance of Allah's messenger is that you attend except when the person inviting you is the bridegroom in the wedding; the obligatory thing is for you in that circumstance is to accept his invitation. It would not be permissible for you to reject it based on the Prophet's saying that, "Whoever does not accept (the invitation) has disobeyed Allah and His Messenger." This refers to invitations to wedding feasts. As for other invitations, you are at liberty.
For instance: If a person invites you for a feast on his return from a journey or he just invited his friends to a meal and similar other things, you are free to choose; if you will you should attend, and if not, do not. This is the view of the majority of scholars.
Some scholars say: It imperative for you to honor the invitations for wedding feast and others except for a reason valid in the Sharee'ah.
So, when you attend while you are not fasting, eat, and if you are fasting, supplicate for the host and inform him of your fast, so that he does not bear any grudge against you. But if you feel that he will be more pleased if you eat, break the fast; except the fast is obligatory in which case you should not break it.
It is now clear that the issue has three situations:
The first: When he invites you while you are not fasting; you should eat.
The second: When he invites you while you are observing an obligatory fast; do not eat, do not break the fast.
The third: If he invites you and you are observing a supererogatory fast, you are at liberty to eat, and if you choose you may not, but you should inform him that you are fasting. Here, you should do the most beneficial; if you notice that the best is for you to break the fast, then break it and eat, otherwise, sticking to the fast is better, and Allah knows best.
Concerning the (invitation) cards however, it is not obligatory to honor the invitation in them except when you know that the one
who sent it to you really intended to invite you. This is because, most invitation cards are only sent by a way of showing courtesy, some don't really bother whether you attended it or not. But if you know that he actually cares about your presence or absence owing to his being a relative or friend of yours, then you should honor the invitation.
Allah alone grants success.