The explosive increase of the availability of personal mobile devices has brought about a significant amount of peer-to-peer communication opportunities upon their encountering, which can be exploited to realize distributed message transmission among mobile devices. However, the opportunistic encountering among mobile devices, which is determined by the mobility of their holders, has introduced great difficulties on efficiently transmitting a message to its designated destination. Actually, people usually present a certain pattern on daily mobility. Further, device holders often belong to a certain social network community. Therefore, in this paper, we propose a social- based cyber-physical system for distributed message transmission, namely SocMessaging, by integrating both the mobility pattern and the social network of device holders. When selecting an encountered node for message relay, in addition to the node's historical encountering records with the destination node, SocMessaging also considers its social closeness with the destination node. Then, the message is always transmitted to the node that is most likely to meet its destination. As a result, SocMessaging closely connects the cyber world (i.e., network), physical world (i.e., people) and social network (i.e., social connection). Finally, our experimental results demonstrate the efficiency of the proposed system in message transmission between device holders.