2 人の異なるユーザーに同時に 2 つのメールを送信したいと考えています。PHPのメール機能を利用しています。以下はコードです。
Send_Mail('abc@example.com,abc2@example.com','Welcome',$message);
単一のユーザーに送信すると正常に動作します.しかし、2つのメールアドレスを追加すると機能しません..これを解決する他の方法はありますか??? 助けてくれよ..
前もって感謝します..
これを試して:
$recipients = array('abc@example.com','abc2@example.com');
foreach ($recipients as $to) {
Send_Mail($to,'Welcome',$message);
}
また
$to = 'abc@example.com,abc2@example.com';
Send_Mail($to,'Welcome',$message);
これを試して:
//複数の受信者
$ to='abc@example.com'。'、'; //カンマに注意してください
$to。='def@example.com';
send_Mail($ to、'ようこそ'、$ message);
$emailArray = array ('abc@example.com','abc2@example.com');
for($i=0;$i<count($emailArray);$i++)
{
Send_Mail($emailArray[$i],'Welcome',$message);
}
配列データに基づいて、無制限のメールを送信できるようになりました
メール機能は複数の ID でまったく問題なく動作します。メールの送信中に smtp ログを確認してください。他の何かが壊れている可能性があります。
詳細については、http: //php.net/manual/en/function.mail.phpを参照してください。
複数のアドレスに電子メールを送信する場合は、ヘッダーで受信者を指定する必要がある場合があります。
$to = 'abc@example.com' . ', ' . 'abc2@example.com';
$subject = 'Welcome';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: ' . $to . "\r\n";
//$headers .= 'From: Someone <someone@example.com>' . "\r\n";
//$headers .= 'Cc: otherperson@example.com' . "\r\n";
//$headers .= 'Bcc: theotherperson@example.com' . "\r\n";
Send_Mail($to, $subject, $message, $headers);