Pulp
|
Posted: 10/27/2003, 7:18 AM |
|
Hello.
I have a problem sending my Newsletter with the PHP mail function in CCS...
I have a HTML page, newsletter.php?user_id=xxx wich I would like to be sent to my website users, depending on the user_id parameter.
I first thougt it would be easy to send a simple HTML file composed this way :
<html>
<frameset rows="*">
<frame src="http://...../newsletter.php?user_id=xxx
</frameset>
</html>
... but unfortunately, the frame is hidden in most mailboxes... I tried with iframes too but it didn't work.
Would somebody here help me ? Thanks a lot.
Pulp
|
|
|
Pulp
|
Posted: 10/27/2003, 8:34 AM |
|
Hello again. Here is the way i solved the problem described above...
I used this little function to get the HTML code that should be displayed by the user browser :
function PHPtoHTML ($url)
{
$sf = fopen($url, "r");
$str = "";
ob_start();
while( !feof($sf) )
{
$line = fgets($sf, 4096);
eval("$line = \"".addslashes($line)."\";");
$str .= stripslashes($line);
}
ob_end_clean();
return $str;
}
Then my script sends this $str (the HTML code) by mail to the user.
This is what is done for EACH user. As there are about 1000 users concerned, I fear this solution to be quite heavy ! Isn't there a better way ?
Yes ? No ?
Thanks a lot
Pulp
|
|
|
Kevin A
|
Posted: 10/28/2003, 1:24 AM |
|
We put the html code into our php file using EOT then fill an array with user e-mails
---------
$htm = <<<EOT
<HTML>
<HEAD>
<TITLE>SomeDomain.com E-mail</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!-- blah - blah
</BODY>
</HTML>
EOT;
do
{
mail($userEmail, $subject, $htm, $headers);
}
while($userEmail = next($mailArray))
|
|
|
Pulp
|
Posted: 10/31/2003, 6:05 AM |
|
Ok, but doing things this way will prevent me from modifying my newsletter in CCS again...
Pulp
|
|
|
Feha
|
Posted: 10/31/2003, 12:32 PM |
|
If news letter is general to all users
than you dont need to parse page in every loop of 1000
put this
function PHPtoHTML ($url)
{
$sf = fopen($url, "r");
$str = "";
ob_start();
while( !feof($sf) )
{
$line = fgets($sf, 4096);
eval("$line = \"".addslashes($line)."\";");
$str .= stripslashes($line);
}
ob_end_clean();
return $str;
}
$str=PHPtoHTML ($url);//call function once before while loop
before while loop...
and echo only $str variable with every e-mail (e-mail body) ...
regards
feha
[www.vision.to]
|
|
|
Pulp
|
Posted: 11/03/2003, 1:14 AM |
|
Unfortunately, the newsletter isn't general to all users...
Thanks,
Pulp
|
|
|
|
|