There could be a couple of things happening here. The first thing I would suggest is to use exception handling to find the actual error. Or look at the ULS logs to trace the problem. Make sure the communication between the servers is not being disrupted. If all else, SharePoint has its own mechanism for sending email,
SPUtility.SendEmail[
^]