I'm using the "Email Change Confirmation" (email_confirm) module with Drupal 7. It works well. However, I also have a user_login hook that sets certain users' email addresses, thus:
user_save($user, ['mail' => '<new address>']);
In this instance, I want the change to take effect immediately, without the need for confirmation (via email or otherwise). The module already provides a configuration option to override sending a confirmation email when the address is changed via the interface by users with specified roles. I want it to behave like that when I change it via the login hook. Is there a way to override sending an email in this case?