How to change sender email Id using hook_mail_alter
According to the documentation:
/**
 * Alter an email message created with MailManagerInterface-&gt;mail().
 *
 * Hook hook_mail_alter() allows modification of email messages created and sent
 * with MailManagerInterface-&gt;mail(). Usage examples include adding and/or
 * changing message text, message fields, and message headers.
 *
 * Email messages sent using functions other than MailManagerInterface-&gt;mail()
 * will not invoke hook_mail_alter(). For example, a contributed module directly
 * calling the MailInterface-&gt;mail() or PHP mail() function will not invoke
 * this hook. All core modules use MailManagerInterface-&gt;mail() for messaging,
 * it is best practice but not mandatory in contributed modules.
...

Can we check if the mail is sent MailManagerInterface-&gt;mail() like this and not any other way.