The e-mail was sent over a state computer and was seen by an assistant to his wife, Patricia, who had worked at the Department of Environmental Protection but now works at the Department of State.
The full context of the e-mail, in which Allan made a wordplay on colored, was not available.
It is unclear how the e-mail came to Corbett's attention.
Efforts to reach Allan at his home outside Harrisburg were unsuccessful.
Ellen Ferretti, deputy secretary for parks and forestry, was named acting secretary, Corbett said in the statement.
Ferretti, a former president of the Northeast regional office of the Pennsylvania Environmental Council, was hired by Allan as his deputy.
Allan, a former scrap-metal recycler, was named secretary shortly after Corbett took office in January 2011.
Allan stirred controversy among environmentalists and park enthusiasts over his handling of proposed gas drilling in a state forest in the north- central section of the state.
Environmentalists were angry that Allan and drilling company Anadarko Petroleum negotiated in secret over the firm's effort to open drilling on 18,000 acres in the Loyalstock State Forest.
They said that broke with past policy in which the public was notified and given the opportunity to provide input on major agency decisions.
Two days ago, a coalition of environmental groups called on Corbett for public release of the gas-drilling proposal and a 90-day comment period, including statewide hearings.
Allan is the sixth Corbett cabinet secretary to resign in the last nine months, following the departures of the secretaries of the Departments of Environmental Protection, Public Welfare, Health, and Education, and the inspector general.
Contact Angela Couloumbis
at 717-787-5934 or firstname.lastname@example.org, or follow on Twitter @angelasink.