public function mail(array
$message) { // If 'Return-Path' isn't already set in php.ini, we pass it separately
// as an additional parameter instead of in the header.
if (isset($message['headers'
]['Return-Path'
])) { $return_path_set =
strpos(ini_get('sendmail_path'
), ' -f'
);
if (!
$return_path_set) { $message['Return-Path'
] =
$message['headers'
]['Return-Path'
];
unset($message['headers'
]['Return-Path'
]);
} } $headers =
new Headers();
foreach ($message['headers'
] as $name =>
$value) { if (in_array(strtolower($name), self::MAILBOX_LIST_HEADERS, TRUE
)) { // Split values by comma, but ignore commas encapsulated in double
// quotes.
$value =
str_getcsv($value, ','
);
} $headers->
addHeader($name,
$value);
} $line_endings = Settings::
get('mail_line_endings', PHP_EOL
);
// Prepare mail commands.
$mail_subject =
(new UnstructuredHeader('subject',
$message['subject'
]))->
getBodyAsString();