a具有PHP郵件功能,該功能可將電子郵件發送到MySQL數據庫中的地址。PHP驗證由逗號分隔的電子郵件地址
在數據庫中,當有多個郵件地址時,用逗號分隔郵件地址。
if(filter_var($email_to, FILTER_VALIDATE_EMAIL))
但這只是一個電子郵件地址的作品,我怎麼能驗證多用逗號分隔:
我已經嘗試使用?
,如:
[email protected],[email protected]
這裏是我的電子郵件功能:
require_once "/usr/local/lib/php/Mail.php";
$from = $email_from;
$to = $email_to;
$subject = $email_subject;
$body = $email_body;
$host = "mail.domain.co.uk";
$username = "[email protected]";
$password = "*********";
$headers = array ('From' => $from,
'To' => $to,
'Cc' => $cc,
'Subject' => $subject,
'Content-type' => 'text/html');
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$rec = $to.', '.$cc;
$mail = $smtp->send($rec, $headers, $body);
我如何可以驗證在$並$ CC的逗號分隔值?