So, after I did a lil’ bit of research, I found out that when a new user registers, the function wp_new_user_notification is used to send the password via e-mail. That function is located in wp-includes/pluggable.php that -for some reason- isn’t included in wp-login.php. Solved the problem by adding
require( dirname(__FILE__) . '/wp-includes/pluggable.php' );
in wp-login.php.