If the certificate includes Subject Alternative Name extension (OID = 2.5.29.17) the GetMailAddresses() returns value(s) from Subject Alternative Name field.
If this extension is not present, the email section of Distinguished Name (text after the 'E=' in Subject field) is returned.