Datacenters' excessive energy consumption has become an increasingly significant pain point to cloud service providers. However, existing research usually tends to focus on the server power cap to increase application throughput and do not address the rapid growth in the energy consumption of datacenters. Although the serverless architecture makes it more difficult to improve datacenter energy efficiency due to its high density and high dynamic nature, we observe that the emerging serverless workloads bring new opportunities for energy reduction. First, the energy consumption of serverless workloads during their execution time can be divided into three stages with clear boundaries: startup, runtime and idle. As the three stages have quite different energy usage patterns, we are able to reduce overall energy consumption through orchestrating the energy consumption of the stages. Second, we observe the energy fungibility phenomenon, i.e., the different combinations of multidimensional resource allocations may lead to the same latency but different energy consumption. Exploiting the balanced combination of energy consumption and performance, we can reduce the overall energy consumption without violating the latency service level agreement (SLA). Based on this, we propose RAEF, a function-level resource allocator that proactively adjusts the resources of the functions for minimizing the energy consumption with SLA guarantees. Evaluation results demonstrate that RAEF reduces energy consumption by up to 21.2 % compared to the state-of-the-art technique while guaranteeing the SLA.