Method for preparing a beverage in a machine for preparing beverages comprising a tank fluidly connected to a filtering container suitable to contain an aromatic mixture, and to an outlet for the beverage (14, 16) associated with selective delivery devices, wherein the method provides to: - receive at entry, in a control and command unit, a signal relating to the organoleptic characteristics of a beverage to be prepared selected by a user through a user interface; - receive at entry, in the control and command unit, a signal relating to the quantity of beverage to be prepared; - determine the operating parameters for a pump and a heating device to regulate the water temperature and flow rate as a function of the selected beverage; - recognize whether a receptacle suitable to receive the beverage is positioned in a delivery zone of said machine by means of at least one recognition device comprising one or more presence detection sensors configured to emit and receive electromagnetic radiations or ultrasounds along a determinate extension in height in said delivery zone, and transmit a signal to said control and command unit; - process the signals received from said recognition device to estimate a size and a capacity of said receptacle and verify if said estimated size and capacity are consistent with the quantity of beverage selected by the user; - command the functioning of at least one between said pump, said heating device, and said selective delivery devices associated with said outlet for the beverage (14, 16) as a function of the signal received from said recognition device and of the selection made by said user wherein as a function of the outcome of the verification, said method provides to prepare and/or deliver a smaller quantity of beverage, correlated to the estimated size and capacity of the recognized receptacle. - receive at entry, in a control and command unit, a signal relating to the organoleptic characteristics of a beverage to be prepared selected by a user through a user interface; - receive at entry, in the control and command unit, a signal relating to the quantity of beverage to be prepared; - determine the operating parameters for a pump and a heating device to regulate the water temperature and flow rate as a function of the selected beverage; - recognize whether a receptacle suitable to receive the beverage is positioned in a delivery zone of said machine by means of at least one recognition device comprising one or more presence detection sensors configured to emit and receive electromagnetic radiations or ultrasounds along a determinate extension in height in said delivery zone, and transmit a signal to said control and command unit; - process the signals received from said recognition device to estimate a size and a capacity of said receptacle and verify if said estimated size and capacity are consistent with the quantity of beverage selected by the user; - command the functioning of at least one between said pump, said heating device, and said selective delivery devices associated with said outlet for the beverage (14, 16) as a function of the signal received from said recognition device and of the selection made by said user