function email($to, $subject, $body) { $transport = getEmailTransport(); $message = Swift_message::newInstance($subject); $message->setFrom(array(get_option("admin_email") => get_option("blogname"))); $message->setTo($to); $message->setBody($body); $message->batchSend(); }
function email($to, $subject, $body) { $transport = getEmailTransport(); $message = Swift_message::newInstance($subject); $message->setFrom(array(get_option("admin_email") => get_option("blogname"))); $message->setBody($body); if (!is_array($to) || count($to) < 2) { $message->setTo($to); $message->send(); } else { foreach ($to as $address => $name) { if (is_int($address)) { $message->setTo($name); } else { $message->setTo(array($address => $name)); } $message->send(); } } }