An electronic device is provided. The electronic device includes a capsule container configured to contain at least one capsule, a discharge structure configured to discharge a material included in the capsule, a transceiver configured to transmit data to an external device or to receive data from the external device, and at least one processor. The at least one processor is configured to receive, user state information and biometric information from the external device via the transceiver, select at least one capsule in the capsule container on the basis of the received user state information and biometric information, determine a spray amount of a material contained in the selected at least one capsule, and spray the material via the discharge structure.