<?
if($_POST[format] == 1)
{
$str = <<<EOD
<!-- tinyMCE -->
<script language="javascript" type="text/javascript" src="htmleditor/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
    // Notice: The simple theme does not use all options some of them are limited to the advanced theme
    tinyMCE.init({
        mode : "exact",
        elements : "msg_area",
        width : "576",
        height : "380",
        theme : "advanced",
        plugins : "table,advhr,advimage,advlink,insertdatetime,preview,zoom,contextmenu",
        theme_advanced_buttons1_add_before : "newdocument,separator",
        theme_advanced_buttons1_add : "fontselect,fontsizeselect",
        theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor,zoom",
        theme_advanced_buttons3_add_before : "tablecontrols,separator",
        theme_advanced_buttons3_add : "advhr",
        extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
        theme_advanced_disable : "help,code,styleselect"
    });


function toggleHTMLmode()
{
    var element = document.getElementById("htmlmode");

    if(element.checked == true)
    {
        tinyMCE.execCommand('mceRemoveControl',false,'msg_area');
        }
    else
    {
    tinyMCE.execCommand('mceAddControl',false,'msg_area');
    }
}
</script>
<!-- /tinyMCE -->
EOD;
echo $str;
}
?>

<style type="text/css" media="screen">@import "css/basic.css";</style>
<style type="text/css" media="screen">@import "css/tabs.css";</style>

</head>

<body>

<h1>Simple Mailing List</h1>

<?
if($_POST[submit_send] And strlen($_POST[message]) > 0)
{
    // Send mail
    // if sent and archived, print confirmation

    $query = "SELECT address FROM mailinglist_subscribers WHERE confirmed = '1'";
    $result = mysql_query($query) or die("Query failed : " . mysql_error());
    $sent_count = mysql_num_rows($result);

    $subscribers = substr($bcc, 0, -1);

    $to = $owner_email;
//  $message = wordwrap($message, $columns, "\n");

    $sent_date = time();
    if ($_POST[format] == 1)
    {
        $texthtml = "html";
    }
    else
    {
        $texthtml = "text";
    }

    $message = addslashes($message);
    $query = "INSERT INTO mailinglist_messages (subject,message,created,queued,count,format) VALUES ('$subject','$message','$sent_date','$utime','$sent_count','$texthtml')";
    $result = mysql_query($query) or die("Query failed : " . mysql_error());
    $message_id = mysql_insert_id();

    if (isset($queue_size))
    {
        $address_query = "SELECT address FROM mailinglist_subscribers WHERE confirmed = '1'";
        $address_result = mysql_query($address_query) or die("Query failed : " . mysql_error());
        while ($address_row = mysql_fetch_assoc($address_result))
        {
            $queue_insert_query = "INSERT INTO mailinglist_queue (message_id,address,send_after) VALUES ('$message_id','$address_row[address]','$utime')";
            $queue_insert_result = mysql_query($queue_insert_query) or die("Query failed : " . mysql_error());
        }
        echo "<p><b><font color=Green>Your message has been queued for delivery and archived.</font></b> You can view the delivery progress in the <a href=archives.php>Archives</a>.</p>";
    }
    else
    {
        $send_message = $message;

        $send_message .= "\n\n\n\nYou are receiving this message because you have opted in to the $list_name list.";
        $send_message .= " To unsubscribe, please follow this link: $unsub_url"; 


        if ($_POST[format] == 1)
        {
            $boundary = md5(uniqid(time()));

            $headers = "MIME-Version: 1.0\r\n";
            $headers .= "Content-type: multipart/alternative;\r\n";
            $headers .= " boundary=\"$boundary\"\r\n";

            $send_message = "you shouldn't see this ever\r\n\r\n";

            $send_message .= "--$boundary\r\n";

            $send_message .= "Content-type: text/plain;\r\n";
            $send_message .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
            $send_message .= strip_tags($message) . "\r\n";

            $send_message .= "--$boundary\r\n";

            $send_message .= "Content-type: text/html;\r\n";
            $send_message .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
            $send_message .= $message . "\r\n";

            $send_message .= "--$boundary--\r\n";
        }

            $headers .= "From: $owner_email\r\nReply-To: $owner_email\r\nBcc: $subscribers\r\nX-Mailer: NotOneBit.com Simple Mailer";

             while ($row = mysql_fetch_assoc($result))
             {
                 mail($row[address], $subject, $send_message, $headers);
             }          
    }
    }
?>

I'm having issues with this code. It tells me that this line:

mail($row[address], $subject, $send_message, $headers);

is giving me an unexpected T_String, but I've looked at this code for half an hour and I'm not seeing where the error is. Please help!!!

well just looking at the third line

$str = <<<EOD

I can see it right there, Don't even get me started on all the other lines that are missing quotes

Interesting. I should let you know that this isn't my script—it's the mailing list script I got from Not One Bit Software. And while I appreciate you taking the time to reply, I don't find your comment helpful so much as quite a bit unnecessarily rude, as it pretty much just tells me that my script is crap without telling me what to fix to not make it so.

Either way, I've found a way to make it work. Thanks again!

Just a sidenote for future reference, you may want to use the code tags so it is more readable to the users reading the code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.