Jump to content

[SOLVED] Repeat a PHP String


wrigley

Recommended Posts

I need to repeat the

$headers .= 'Bcc: $row_rs_adm_subscribers['email']' . "\r\n";

section of the code with all the emails that are in the database.  I can't just do a repeat region because it wants to repeat the entire php code section.  I just need that one section

 

<?php

$to = "EMAIL ADDRESS DELETED";
$subject = "$row_rs_adm_newsletter[subject]";

$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<center>
Created on $row_rs_adm_newsletter[date]
$row_rs_adm_newsletter[body]
</center>
</body>
</html>
";

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: <EMAIL ADDRESS DELETED>' . "\r\n";
$headers .= 'Bcc: $row_rs_adm_subscribers['email']' . "\r\n";


mail($to,$subject,$message,$headers);
?>

 

This would be an example of what I need...

 

<?php

$to = "EMAIL ADDRESS DELETED";
$subject = "$row_rs_adm_newsletter[subject]";

$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<center>
Created on $row_rs_adm_newsletter[date]
$row_rs_adm_newsletter[body]
</center>
</body>
</html>
";

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: <EMAIL ADDRESS DELETED>' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";


mail($to,$subject,$message,$headers);
?>

 

Thanks in advance!

 

 

Link to comment
https://forums.phpfreaks.com/topic/135088-solved-repeat-a-php-string/
Share on other sites

this is what I ended up doing....thank you so much for your help!

 

// More headers
$headers .= 'From: <[email protected]>' . "\r\n";

while($row_rs_adm_subscribers = mysql_fetch_assoc($rs_adm_subscribers))
{
$headers .= 'Bcc:'. $row_rs_adm_subscribers['email']. "\r\n";
}

mail($to,$subject,$message,$headers);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.