A word to high-school seniors rejected by their first choice: A degree from that shiny, elite college on the hill may not matter nearly as much as you think.

A new Gallup survey of 30,000 college graduates of all ages in all 50 states has found that highly selective schools don't produce better workers or happier people, but inspiring professors—no matter where they teach—just might.

The poll, undertaken this spring, is part of a growing effort to measure how well colleges do their jobs. This survey adds an interesting twist, because it looked not only at graduates after college; it tried to determine what happens during college that leads to well-being and workplace engagement later in life.

The poll didn't measure graduates' earnings. Rather, it was rooted in 30 years of Gallup research that shows that people who feel happy and engaged in their jobs are the most productive. That relatively small group at the top didn't disproportionately attend the prestigious schools that Americans have long believed provided a golden ticket to success. Instead, they forged meaningful connections with professors or mentors, and made significant investments in long-term academic projects and extracurricular activities.

"It matters very little where you go; it's how you do it" that counts, said Brandon Busteed, executive director of Gallup Education. "Having a teacher who believes in a student makes a lifetime of difference."