Mishkat al-Masabih 1767
وَعَنْ عَائِشَةَ رَضِيَ اللَّهُ عَنْهَا قَالَتْ: كَيْفَ أَقُولُ يَا رَسُولَ اللَّهِ؟ تَعْنِي فِي زِيَارَةِ الْقُبُورِ قَالَ: قُولِي: السَّلَامُ عَلَى أَهْلِ الدِّيَارِ مِنَ الْمُؤْمِنِينَ وَالْمُسْلِمِينَ وَيَرْحَمُ اللَّهُ الْمُسْتَقْدِمِينَ مِنَّا وَالْمُسْتَأْخِرِينَ وَإِنَّا إِنْ شَاءَ اللَّهُ بِكُمْ للاحقون . رَوَاهُ مُسلم
From ʿAʾishah, may Allah be pleased with her, who said: "How should I say, O Messenger of Allah?" meaning when visiting graves. He said: "Say: Peace be upon the inhabitants of the dwellings, of the believers and the Muslims. May Allah have mercy on those of us who have gone ahead and those who come later, and we, if Allah wills, will be joining you." Reported by Muslim.