Due to technology or policy constraints, communications across network domains usually require the intervention of gateways, and their proper deployment is crucial to the overall performance. In this paper, we study the problem of placing static gateways in mobile DTNs consisting of multiple domains. Given a limited gateway budget, the problem is to select deployment locations to optimize certain performance. The challenge is that different domains may possess heterogeneous properties. To ensure general applicability of solution, we propose a unified framework based on utility optimization, and solve utility computation and placement optimization separately. To handle heterogeneity, we decompose utility computation into individual domains and derive closed-form solutions based on key domain characteristics with focus on the routing scheme. Moreover, we develop quadratic-complexity algorithms to solve the optimization efficiently, which has guaranteed performance under certain uniformity conditions. Although certain assumptions have been made in developing the solutions, evaluations based on synthetic data and real DTN traces both show that the proposed solutions can achieve near-optimal (within 5%) performance at much lower complexities, and the results are robust with respect to the routing schemes and the mobility patterns. Compared with utility-agnostic deployments, our solutions significantly improve the end-to-end performance (by up to 50%).