An atomizer for an electronic cigarette, comprising: a housing; a mouthpiece detachably connected with the housing; a liquid tank in the housing, the liquid tank defining a liquid chamber configured for storing tobacco liquid; an atomizing cup in the liquid tank, the atomizing cup defining an atomizing chamber; an atomizing assembly in the atomizing chamber, the atomizing assembly being configured for generating aerosol from the tobacco liquid; an air pipe communicating the atomizing chamber and the mouthpiece; wherein the atomizer further comprises a movable element and an elastic element; the movable element has a fixing end and a connecting end, the fixing end is connected with the air pipe, the connecting end nests an exterior surface of the atomizing cup, the elastic element nests an exterior surface of the connecting end; the atomizing cup comprises a sidewall defining at least one through hole, the connecting end defines at least one liquid inlet; when the mouthpiece is connected to the housing, the mouthpiece abuts against the air pipe, and drives the air pipe and the movable element to compress the elastic element axially, so that the at least one through hole is in communication with the at least one liquid inlet, and the atomizing assembly absorbs the tobacco liquid flowed from the at least one through hole; when the mouthpiece is detached from the housing, the air pipe and the movable element are driven by the elastic element to restore to an initial position where the at least one through hole is misaligned with the at least one liquid inlet, the tobacco liquid cannot flow into the liquid inlet. a housing; a mouthpiece detachably connected with the housing; a liquid tank in the housing, the liquid tank defining a liquid chamber configured for storing tobacco liquid; an atomizing cup in the liquid tank, the atomizing cup defining an atomizing chamber; an atomizing assembly in the atomizing chamber, the atomizing assembly being configured for generating aerosol from the tobacco liquid; an air pipe communicating the atomizing chamber and the mouthpiece; wherein the atomizer further comprises a movable element and an elastic element; the movable element has a fixing end and a connecting end, the fixing end is connected with the air pipe, the connecting end nests an exterior surface of the atomizing cup, the elastic element nests an exterior surface of the connecting end; the atomizing cup comprises a sidewall defining at least one through hole, the connecting end defines at least one liquid inlet; when the mouthpiece is connected to the housing, the mouthpiece abuts against the air pipe, and drives the air pipe and the movable element to compress the elastic element axially, so that the at least one through hole is in communication with the at least one liquid inlet, and the atomizing assembly absorbs the tobacco liquid flowed from the at least one through hole; when the mouthpiece is detached from the housing, the air pipe and the movable element are driven by the elastic element to restore to an initial position where the at least one through hole is misaligned with the at least one liquid inlet, the tobacco liquid cannot flow into the liquid inlet.