New method could reduce environmental impact of extracting metals from raw materials and post-consumer electronics