A multiproduct pipeline provides an economic way to transport large volumes of refined petroleum products over long distances. In such a pipeline, different products are pumped back−to−back without any separation device between them. The sequence and lengths of such pumping runs must be carefully selected in order to meet market demands while minimizing pipeline operational costs and satisfying several constraints. The production planning and scheduling of the products at the refinery must also be synchronized with the transportation in order to avoid the usage of the system at some peak−hour time intervals. In this paper, we propose a multi−period mixed integer nonlinear programming (MINLP) model for an optimal planning and scheduling of the production and transportation of multiple petroleum products from a refinery plant connected to several depots through a single pipeline system. The objective of this work is to generalize the mixed integer linear programming (MILP) formulation proposed by Cafaro and Cerdá (2004, Computers and Chemical Engineering) where only a single planning period was considered and the production planning and scheduling was not part of the decision process. Numerical examples show how the use of a single period model for a given time period may lead to infeasible solutions when it is used for the upcoming periods. These examples also show how integrating production planning with the transportation and the use of a multi−period model may result in a cost saving compared to using a single−period model for each period, independently.