Replace the line
mail ("{$ad['display_name']} <$email>", $subject, $html, $headers);
with
wp_mail("{$ad['display_name']} <$email>", $subject, $html, $headers);
and install the WP_Mail_SMTP
plugin which will use SMTP instead of the php mail()
function.