It is narrated from Sayyiduna Abdullah bin Salam (may Allah be pleased with him) that "when he entered the mosque he would send salam upon the Prophet (peace and blessings be upon him), then say: 'Allahumma iftah li abwaba rahmatik' (O Allah, open for me the doors of Your mercy); and when he came out of the mosque he would send blessings (durud) upon the Prophet (peace and blessings be upon him) and seek refuge with Allah from Satan."
This chain is da'if (weak).
Hadith Referenceإتحاف الخيرة المهرة بزوائد المسانيد العشرة / كتاب المساجد / 991