array() problem sending mass email with swiftmailing
Posted: Mon Jul 10, 2006 3:28 am
Hi guys,
well, swift mail is having a script that works like this: This works fine. Now I wanted to add something like Hi .$row[name] at the beginning of every mail send. So, I have tried to modify this script in this way, Unfortunately, when the email is going, senders are getting this:
Can anyone help me to figure out where I'm doing something wrong?
Thanks a lot.
PS. I think I am not even sure if it's possible. Swiftmailer is sending the mail once only for all the addresses, taking all the addresses in an array. Had it been sending seperate mail to each, this could have been possible, as in mail(). I still would like to see what other's think, and may be Swiftmailer is not the best solution to send mass mail in that case (and in this way).
PS2. I just read the interesting story of MsGruff in http://www.phpbuilder.com/board/archive ... 12185.html ... well, nice that things have been solved ... and if Chris is back again as a moderator of this site, may be he could tell if sending personalized mass mail as I am trying would be possible with Swiftmailing, as he is the author of that code ...
Thanks.
well, swift mail is having a script that works like this:
Code: Select all
$subject = 'Some subject';
$sender = '"George Bush" <george@bush.com>';
$recipients = array();
$result = mysql_query("SELECT name, surname, email from $my_table");
while ($row = mysql_fetch_assoc($result)) {
$recipients[] = array($row['name'].' '.$row['surname'], $row['email']);
}
$message = stripslashes($_POST['themessage']);
if ($mailer->isConnected())
{
$mailer->send(
$recipients,
$sender,
$subject,
$message
);
$mailer->close();
}Code: Select all
$subject = 'Some subject';
$sender = '"George Bush" <george@bush.com>';
$recipients = array();
$thename = array();
$result = mysql_query("SELECT name, surname, email from $my_table");
while ($row = mysql_fetch_assoc($result)) {
$recipients[] = array($row['name'].' '.$row['surname'], $row['email']);
$thename[] = array($row['name']);
$message = '<p>Hi '.$thename.'</p>';
}
$message .= stripslashes($_POST['themessage']);
if ($mailer->isConnected())
{
$mailer->send(
$recipients,
$sender,
$subject,
$message
);
$mailer->close();
}Code: Select all
Hi Array
Message goes here ...Thanks a lot.
PS. I think I am not even sure if it's possible. Swiftmailer is sending the mail once only for all the addresses, taking all the addresses in an array. Had it been sending seperate mail to each, this could have been possible, as in mail(). I still would like to see what other's think, and may be Swiftmailer is not the best solution to send mass mail in that case (and in this way).
PS2. I just read the interesting story of MsGruff in http://www.phpbuilder.com/board/archive ... 12185.html ... well, nice that things have been solved ... and if Chris is back again as a moderator of this site, may be he could tell if sending personalized mass mail as I am trying would be possible with Swiftmailing, as he is the author of that code ...