the problem i am facing is that i need to set a page which has mysql in it to retrieve images from a database as a newsletter.

i am at the stage where i have all the application set up and it works how it is meant; but it will not load the content of the page into the email which is sent out. the email is just a blank page.

i have used the file get contents function of php and the fopen which both had the same result, the closest i have got to it passing the data on is a couple of semi colons on the page which is the end of the code for the mysql on th original page.

i no there is away of sending the page as an attachment but it needs to have the page set as the email.

i have been working on this now for the last few days and i would really like to no if it is possible to do what i need with the methods i have been using or if i should try a different method

can you post your code? its hard to help when i don't know exactly what i am dealing with.

the page i want to include in the email looks like this

<table width="900" border="0" align="center" cellpadding="0" cellspacing="5">
    <tr>
        <td height="95" colspan="2" scope="col"><img src="layout/BroadsheetSample/broadhead.jpg" width="900" height="150" /></td>
    </tr>
    <tr>
        <td height="25" colspan="2" scope="col"><span class="title"><?php echo ($broad_topictitle1); ?></span></td>
    </tr>
    <tr>
        <th width="23%" height="200" scope="col"><div align="left">
            <p>

					<?php
						
					$query = "SELECT broad1 FROM images_broad";
					$result=mysql_query($query);

					while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
					echo '<img src="'.$row['broad1'].'"/>';
					}
						      
					?>
			
            <p>&nbsp;</p>
        </div></th>
        <td width="77%" scope="col"><table width="99%" border="0" cellpadding="10" cellspacing="0">
            <tr>
                <td align="left" valign="top"><span class="mainTxt"><?php echo  ($broad_messagebody1); ?></span></td>
                <!-- End Image 1 -->
            </tr>
        </table>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p></td>
    </tr>
    <tr>
        <td height="28" colspan="2" scope="col"><span class="title"><?php echo ($broad_topictitle2); ?></span></td>
    </tr>
    <tr>
        <th height="95" scope="col"><div align="left">
            		<?php
						
					$query = "SELECT broad2 FROM images_broad";
					$result=mysql_query($query);

					while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
					echo '<img src="'.$row['broad2'].'"/>';
					}
					
						      
					?>
            <p><br />
            </p>
        </div></th>
        <td scope="col"><table width="99%" border="0" cellpadding="10" cellspacing="0">
                <tr>
                    <td align="left" valign="top"><span class="mainTxt"><?php echo ($broad_messagebody2); ?></span></td>
                    <!-- End Image 1 -->
                </tr>
				
            </table>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                <p>&nbsp;</p></td>
    </tr>
    <tr>
        <td colspan="2" scope="col"><img src="layout/BroadsheetSample/broadfoot.jpg" width="900" height="150" /></td>
    </tr>
    
    <tr>
        <td height="13" colspan="2" scope="col"><div align="justify"><span class="style1">Linacre Voice is a monthly bulletin from LinacreOne Community Partnership 140-142 Linacre Road Litherland L21 8JU Tel: (0151) 922 4898 Open Monday - Thursday 10:00am - 4:00pm <font size="\&quot;1\&quot;"></font></span> </div></td>
    </tr>
</table>

this is just the body of the page and the same with the next code only the body was copied over


and the code i have for the send email page looks like this

<div class="register"> To register another user to Mercury &copy; &reg;<br />
    click <a href="join_form.php">here</a> <br/>
</div>
<div class="logout">
    <form method='post' action='logout.php'>
        <input type='submit' value='logout' name='logout' />
    </form>
</div>

<?php
// construct mailing list array
$merc_list = explode(",",$merc_mailingList);

// deploy the emails
for($i=0; $i<count($merc_list); $i++){

$myFile = "broad_prev.php";
$fh = fopen($myFile, 'rb');
$message = fread($fh, filesize($myFile));
fclose($fh);


	
	// Contacts
	$replyName = "$merc_replyId";
	$replyEmail = "$merc_replyAddress";

	$contactname = "";
	$contactemail = "$merc_list[$i]";

	// Subject
	$subject = "$merc_messageTitle";

	// Headers
	$headers = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .= "From: ".$replyName." <".$replyEmail.">\r\n";
	$headers .= "To: ".$contactname." <".$contactemail.">\r\n";

	mail($contactemail, $subject, $message, $headers);
	 }// END for

?>
<div class="fixed2"><img src="admin/images/content_header.gif" alt="content header" width="648" height="281" class="fixed2" /></div><div class="fixed1"><img src="admin/images/navbg.gif" alt="nav bg" width="152" height="600" /></div>
<div class="fixed5">
    <div id="data">
	<?php echo date('l dS F Y h:i:s A'); ?>
	    
    <p><?php printf("Mercury has successfully sent out %d broadcasts.<br />
		 <BUTTON onclick=\"window.close();\">close this window</BUTTON>
		 ", count($merc_list)); ?>
	</div>
</div>

i originally tried to hard code the page into the send email page but was unablke to get mysql to work it would only display straight html.

is it possible to use the include function but set the included file to be the value of the variable $message if it can be done and it works they way i want it should send the contents of the page in the message as the variable message is sent as the message???

i might be wrong. (i do try tho)

the code in the post above only sends the semi colons through from the the end of the mysql statements on the preview page. nothing else is sent through.

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.