This study proposes a unidirectional-valve (UDV) algorithm for energy-efficient transmission, where the packets arrived at different times must be transmitted before a common deadline. The UDV algorithm divides the total transmission time into a series of segments. For a newly arrived packet, it is regarded as a new segment and its rate is compared with that of the former adjacent one, then the two segments are combined into one if the new segment has a lower or an equal rate. The comparison and combination are alternately performed until the rate on the whole actually becomes non-decreasing. In the offline case that the sizes and arrival times of all packets are learned at the beginning, it has been demonstrated that the UDV scheduling achieves the optimal energy-efficient transmission; while in the online case that only the mean size and mean interval of future packets are known, UDV achieves the energy efficiency approaching the optimality. In addition, the proposed UDV scheduling has a low computational complexity, and thus can be readily implemented in the system.