0

2 人の異なるユーザーに同時に 2 つのメールを送信したいと考えています。PHPのメール機能を利用しています。以下はコードです。

 Send_Mail('abc@example.com,abc2@example.com','Welcome',$message);

単一のユーザーに送信すると正常に動作します.しかし、2つのメールアドレスを追加すると機能しません..これを解決する他の方法はありますか??? 助けてくれよ..

前もって感謝します..

4

5 に答える 5

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);
于 2013-03-14T07:36:59.077 に答える
1

これを試して:

//複数の受信者

$ to='abc@example.com'。'、'; //カンマに注意してください

$to。='def@example.com';

send_Mail($ to、'ようこそ'、$ message);

于 2013-03-14T07:39:36.040 に答える
1
$emailArray = array ('abc@example.com','abc2@example.com');
for($i=0;$i<count($emailArray);$i++)
{
Send_Mail($emailArray[$i],'Welcome',$message);
}

配列データに基づいて、無制限のメールを送信できるようになりました

于 2013-03-14T07:33:57.883 に答える
1

メール機能は複数の ID でまったく問題なく動作します。メールの送信中に smtp ログを確認してください。他の何かが壊れている可能性があります。

詳細については、http: //php.net/manual/en/function.mail.phpを参照してください。

于 2013-03-14T07:36:02.693 に答える
0

複数のアドレスに電子メールを送信する場合は、ヘッダーで受信者を指定する必要がある場合があります。

$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);
于 2013-03-14T07:38:43.570 に答える