2017-12-28 17 views
0

"to"の値がハードコードされるたびに、電子メールが送信されます。しかし、文字列の値が文字列変数に置き換えられると、電子メールは送信されません。Mailgun not変数が値として使用されているときに電子メールを送信PHP

$result = $mgClient->sendMessage($domain, array(
    'from' => 'Eemayl Ok <[email protected]>', 
    'to'  => $customerEmail, 
    'to'  => Tools::safeOutput($customerEmail), 
    'to'  => (string)$customerEmail, 
    'to'  => $customer->email, 
    'to'  => Tools::safeOutput($customer->email), 
    'to'  => '[email protected]', 
    'subject' => 'We Hope You get this Email!', 
    'text' => '', 
    'html'  => '<html>Contact Us Ok??</a></html>'  
)); 

いくつかの「〜」は、可変値を表現する変形例です。

答えて

1

アレイは重複キーを受け入れません。キーが重複している場合は、最後の値のみを選択します。 mailgun APIによれば、カンマを使用して複数の受信者を区切る必要があります。

$recipients = array('[email protected]', '[email protected]'); 
$result = $mgClient->sendMessage($domain, array(
    'from' => 'Eemayl Ok <[email protected]>', 
    'to'  => implode(',', $recipients), 
    'subject' => 'We Hope You get this Email!', 
    'text' => '', 
    'html'  => '<html>Contact Us Ok??</a></html>'  
)); 
+0

応答してくれてありがとう、私は数時間前にそのことを考え出し、プロジェクトを終えたばかりだった。 (まだそれに取り組んで) しかし、私はちょうど別の電子メールで複数の呼び出しを行った*顔を隠す* – ihaveitnow