2
我正在嘗試SwiftMailer將電子郵件地址提取到array()
我有原始示例,並且我知道我想要放入其中但我無法從樹中看到森林...適當的眼睛任何一個在那裏請:php數組和mysql語法錯誤
// Send the message
$result = $mailer->send($message);
// Send the message
$failedRecipients = array();
$numSent = 0;
這裏是我奮力:
foreach($groups as $value)
{
echo "<h3>".$value."</h3>"; //this is working
// get the email groups
$sql="SELECT * FROM emails WHERE sendesstat=1 AND deleted=0 AND classhoz=\"".$value."\"";
$query=mysql_query($sql);
// fetch the emails from the group
while($data=mysql_fetch_array($query))
{
$emil="'".$data["email"]."' => '".$data["firstname"]." ".$data["surname"]."'";
echo $emil;
這echo
是工作,但我不能把$to[]
陣列中......(對不起)這是它應該如何顯示:
$to = array('[email protected]', '[email protected]' => 'A name');
問題是given name => 'A name'
我正在生病,我找不到語法!
$to[ ]= $emil;
}
}
foreach ($to as $address => $name)
{
if (is_int($address)) {
$message->setTo($name);
} else {
$message->setTo(array($address => $name));
}
$numSent += $mailer->send($message, $failedRecipients);
}
printf("Sent %d messages\n", $numSent);
請請一切正在工作現在只有這一點丟失。謝謝
非常感謝我打算把我的代碼:))))非常感謝再次 – 2012-03-18 01:42:54
@AndrasSebestyen,我很高興它爲你工作。 – Starx 2012-03-18 01:53:12