In this case, that was not the same assumption I was making, and I was surprised - once, during implementation; a wrapper using filter_var brought the assumptions of the library in line with the assumptions for the project. That is, obviously, not universal advice.
As for "why no mitigation" - even though it abstracts the horror of mail(), a library is a power tool with sharp edges, not a nicely wrapped single-button selfie app. In other words, it already does validation; input sanitization is beyond its scope IMNSHO (this literally means that valid, insane e-mail addresses do exist), and adding that by default would nerf the library. (Also, php_filter is an extension and not installed by default)
"\"Attacker\\' -Param2 -Param3\"@test.com"
Let's try it: <?php
$sender = "\"Attacker\\' -Param2 -Param3\"@test.com";
var_dump(filter_var($sender, FILTER_VALIDATE_EMAIL));
// outputs:
// bool(false)And yes, that is, technically, a valid email address:
"\"Attacker\\' -Param2 -Param3\"@test.com"
gets interpreted by the shell (or by PHP, or by whatever else is responsible for handling backslash-escaped entities in quoted strings) as "Attacker\' -Param2 -Param3"@test.com
and "Attacker\' -Param2 -Param3" is a valid local-part: https://tools.ietf.org/html/rfc5321#section-4.1.2(Email addresses suck and this is not me saying that this is sane.)