When developing and debugging a feature that involves generating emails, it would be useful to set for example
$CFG->divertallemailsto = 'some.email@localhost.local';
Then all emails generated by Moodle would end in this mailbox instead of the real address.