Hi Muhammad,
I had the same issue when I set up my latest build and wish I had come across this sooner
https://moodle.org/plugins/view/local_mailtest
It will let you know where its failing whether it is your settings or whether it is getting stuck elsewhere