Each state shall appoint, in such manner as the legislature thereof may direct, a number of electors equal to the whole number of senators and representatives to which the state may be entitled in the Congress, but no senator or representative or person holding an office of trust or profit under the United States shall be appointed an elector.
The Congress may determine the time and place of choosing the electors and the day on which they shall give their votes, which day shall be the same throughout the United States.
In our first presidential elections, the state legislatures chose the electors. Then the states began to pass that onto the voters via the formula that Maine and Nebraska use today. Then when the two party system, as we know it, came into being, the states switched to a winner-take-all formula.
As late as 1844, South Carolina was still having its state legislature choose electors, and that didn't end until 1868. There is no constitutional requirement for a general election to choose presidential electors. It's simply how the system evolved over time.
The Supreme Court ruled in the 19th Century that final authority over electors still resides with the state legislature. That's why in 2000 the Florida legislature had a slate of Bush/Cheney electors ready to go by the Safe Harbor Date if the courts continued to dither over the subject.
from Wikipedia:
1st election —
“Only 6 of the 10 states casting electoral votes chose electors by any form of popular vote.”
However, presidents have always been chosen by popular vote. 1828 was evidently the first to have more exact counts, about 57.6% of eligible voters voted.