只要“to”值被硬编码,就会发送电子邮件。但是,当字符串值替换为字符串变量时,电子邮件不会被发送。
$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>'
));
几个“to”是我尝试表达变量值的变化。
Array不接受重复键。如果密钥重复,它只选择最后一个值。根据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>'
));