[PHP-DEV] [question] How can I send mails to all members? From: ±è³²Á (njkim <email protected>)
Date: 01/13/00

Hello...

I want to send mails to all members..

So I programmed with php3.

This is source.

<?
include("include/header.ph");

dconnect($db_server,$db_user,$db_pass);
dselect_db($db_name);

$result = dquery("select email from member'");


 if(!$subject)
    { echo(" <script>
                  window.alert('¸ÞÀÏ Á¦¸ñÀÌ ¾ø½À´Ï´Ù. ¸ÞÀÏ Á¦¸ñÀ» ÀÔ·ÂÇØ ÁֽʽÿÀ.')
                  history.go(-1)
                 </script>
               "); exit;
 }

    $mailheaders .= "Return-Path: $from\r\n";
    $mailheaders .= "From: $from\r\n";

    if ($userfile && $userfile_size) {

        $filename=basename($userfile_name);
        $result=fopen($userfile,"r");
        $file=fread($result,$userfile_size);
        fclose($result);

        if ($userfile_type == "")
        {
            $userfile_type = "application/octet-stream";
        }

        $boundary = "--------" . uniqid("part");

        $mailheaders .= "MIME-Version: 1.0\r\n";
        $mailheaders .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";

        $bodytext = "This is a multi-part message in MIME format.\r\n\r\n";
        $bodytext .= "--$boundary\r\n";

        $bodytext .= "Content-Type: text/html; charset=euc-kr\r\n";
        $bodytext .= "Content-Transfer-Encoding: 8bit\r\n\r\n";

        $bodytext .= nl2br(stripslashes($body)) . "\r\n\r\n";
        $bodytext .= "--$boundary\r\n";
        $bodytext .= "Content-Type: $userfile_type; name=\"$filename\"\r\n";
        $bodytext .= "Content-Transfer-Encoding: base64\r\n\r\n";
        $bodytext .= ereg_replace("(.{80})","\\1\r\n",base64_encode($file));
        $bodytext .= "\r\n--$boundary" . "\r\n";
    }
    else {
        $bodytext = stripslashes($body);
    }

    while($row = mysql_fetch_array($result)){
          $result2 = mail($row[0],$subject,$bodytext,$mailheaders);
    }
?>

DB Connection has no problem....

But mails don't be sent...........

I don't know what problem is...

Please tell me how to send mails to all members or errors....

Thanks for reading...