Should I use wp_mail or PHP’s mail? [duplicate]

WordPress offers its own mailing system. I suggest you use that instead of PHP’s native mail.

wp_mail accepts five arguments:

wp_mail( $to, $subject, $message, $headers, $attachments );

So your code can be written this way:

// Set the headers
$headers[] = 'From: ' . get_option('admin_email');
// Add the addresses to an array
foreach($emails as $mail) {
    if(is_email($mail)) {
        $to[] = $mail;
    }
}
// Add the attachment
if($name) {
    $att[] = PLUGIN_DIR.'uploads/'.date('Ymd').'_'.$name;
}
// Send the emails
$results = wp_mail( $to, $subject, $body, $headers, $att );
// Output the results
echo $results;

Simple and short.