mail() internals:
doing some tests i can say... if sendmail_path is defined in php.ini or by ini.set(), by calling function like...
mail($to, $subject, $message, $headers, $params)
would be like if php open a shell internally, execute this command, send this text to stdin, and return true if return value == 0
------------
shell> $sendmail_path $params
To: $to
Subject: $subject
$headers
$message
(EOF)
------------
in windows instead using php smtp which is very limited, i prefer to force use sendmail-like behavior, by setting sendmail_path and then use msmtp for windows