Mulitple mailing with TO:

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
magosla2001
Forum Newbie
Posts: 20
Joined: Sat May 20, 2006 8:54 am

Mulitple mailing with TO:

Post by magosla2001 »

I will like someone to help me on sending emails to multiple recipients with php mailing script using To: instead of BCC: and each recipients recieves his or her message like it was sent to him alone. With his or her email having the recipients email alone and not being blank as it is when using the BCC.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

You could loop through mail().

I am really not sure that you can address a single mail over multiple addresses at once without each address being displayed to the recipient. I am probably wrong about this, but at least this is my understanding of how mail works.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Mulitple mailing with TO:

Post by Chris Corbyn »

magosla2001 wrote:I will like someone to help me on sending emails to multiple recipients with php mailing script using To: instead of BCC: and each recipients recieves his or her message like it was sent to him alone. With his or her email having the recipients email alone and not being blank as it is when using the BCC.
Take a look at the link in my signature ;)
magosla2001
Forum Newbie
Posts: 20
Joined: Sat May 20, 2006 8:54 am

Re: Mulitple mailing with TO:

Post by magosla2001 »

I visited the link in your signature and saved the swift.php and Swift_SMTP_Connection.php to my web server but I am still confused on how to make it work with an HTML form and how to implement your script for sending emails
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Mulitple mailing with TO:

Post by Chris Corbyn »

magosla2001 wrote:I visited the link in your signature and saved the swift.php and Swift_SMTP_Connection.php to my web server but I am still confused on how to make it work with an HTML form and how to implement your script for sending emails
Did you download the zip file? Download it if not, there's a bunch of documentation in there along with some examples in docs/examples.

All you need to do is to take the batch sending example and modify it to suit your needs. Perhaps if you posted in more detail exactly what you need we can draft something together ;)
magosla2001
Forum Newbie
Posts: 20
Joined: Sat May 20, 2006 8:54 am

RE: mailing with to

Post by magosla2001 »

I tried to loop through mail() so as to make my recipients address display each on the To: header and also wanted my recipeint email each included in my message to them using php like; "This message was sent to you with your email address {$to[$index]}." Below was what I tried out

Code: Select all

$to = $_POST['to'];
$to = array($to);

sort($to);

for($index = 0; $index < count($to); $index++)
{
   $to[$index] = ereg_replace("\n", "", $to[$index]);
   mail($to[$index], $subject, $body, "From: $name <$from>\nReply-To: $name <$replyto>\n$headers");
   
   echo ("<DIV style=\"color:teal; size=12px;\">Your message has been sent click to <a href=JavaScript:history.back();>continue</a> ". $_SESSION["name"] . " </div>");
   print $to[$index]. "\n";
    
}

When I stored the email from a form text input seperated by comma in $to variable I still had all emails desplayed in the to: header. I tried using a textarea for the variable $to and placed the email address in a new line I received a message sent comfirmation but the email was never delivered. I also wanted the sent email to be desplayed each in a newline after they have been sent. I need someone to help me out.
Post Reply