ok, last year wrote a script for sending out multi boundary MIME emailers with a mysql database everything was working ok.
somewhere this year the isp upgraded to php 5 and no it seems like my stylesheets are being ignored is there a difference between php 5 and php 4?
also it showed (the first time i sent out the emailer) html code in the emailer?
anyway here is my code:
$sql2 = "select * from some_db where id = some_id";
$rs2 = mysql_query($sql2, $conn) or die ("could not query");
while ($row = mysql_fetch_array($rs2)) {
// read the image in the newsletter [if there is one]
if ($row['upload_img'] != "no image") {
// image to be sent with email
$file = "images-for-articles/$row[upload_img]";
$filesize = filesize($file);
$filetype = filetype($file);
// open the file in a file holder fp
$fp = fopen($file,"r") or die ("could not open file");
// get the file size
$fileinc = fread($fp,$filesize);
// split the file intro 64 base chunks
$fileinc = chunk_split(base64_encode($fileinc));
} // end of loop which checks for image
// sets up the 2nd image for the logo
$file2 = "images-for-articles/mt_logo.gif";
$filesize2 =filesize($file2);
$filetype2 = filetype($file2);
$fp2 = fopen($file2,"r");
$fileinc2 = fread($fp2,$filesize2);
$fileinc2 = chunk_split(base64_encode($fileinc2));
// end of second image
// sets up the third image for the emailer
$file3 = "images-for-articles/mt_head.gif";
$filesize3 =filesize($file3);
$filetype3 = filetype($file3);
$fp3 = fopen($file3,"r");
$fileinc3 = fread($fp3,$filesize3);
$fileinc3 = chunk_split(base64_encode($fileinc3));
// end of third image
// start setting up the emailer
$hdr = "MIME-Version:1.0\r\n";
$hdr .= "Content-Type:multipart/mixed;boundary=MYBOUNDRY-123\r\n";
$hdr .= "From: noreply@somedomain.com\r\n";
// start the first boundary
$hdr .= "--MYBOUNDRY-123\r\n";
$hdr .= "Content-Type:text/html\r\n";
$hdr .= "Content-Transfer-Encoding:7bit\r\n";
$hdr .= "<html><head><style type='text/css'><!--.style2 {color: #000000;font-size: 18px;font-family: Arial, Helvetica, sans-serif;}.style3 {font-family: Arial, Helvetica, sans-serif;font-size: 18px;color: #666666;} .bodycopy-black {font-family: Arial, Helvetica, sans-serif;font-size: 11px;color: #333333;text-decoration: none;font-style: normal;}.tableheaders {font-family: Arial, Helvetica, sans-serif;font-size: 11px;font-weight: bold;text-transform: none;color: #666666;letter-spacing: -0.1px;}.bodycopyblack {font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #000000;}body {margin-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;}.articlecopy_magenta {font-family: Arial, Helvetica, sans-serif;font-size: 11px;color: #993444;text-decoration: none;font-style: normal;text-align: justify;}.articlecopy_grey {font-family: Arial, Helvetica, sans-serif;font-size: 11px;color: #666666;text-decoration: none;font-style: normal;}A:visited {color:#9D3C4D;}A:link {color:#000000;}A:active {color:#000000;}A:hover {color:#666666;}--></style></head>
<table id='Table_01' width='70%' height='100%' border='0' cellpadding='0' cellspacing='0'><tr valign='top'><td rowspan='3'><img src='cid:img123'></td><td><img src='cid:img124' width='378' height='67'></td><td rowspan='8'> </td></tr><tr valign='top'><td valign='top'><span class='style3'>Some Newsletter - Edition - Number ".$row['newsletter_number']." </span></td></tr><tr valign='top'><td valign='top'> </td></tr><tr valign='top'><td rowspan='2'><img src='cid:img4' width='268' height='200'></td><td valign='top' class='bodycopyblack' bgcolor='#BCBCBC'><strong class='style2'>". $row['heading']."</strong></td></tr><tr valign='top'><td valign='top'><span class='articlecopy_magenta'><strong>".$row['sub_heading']."</strong></span><br><span class='articlecopy_grey'><br>".$row['auto_teaser']."....</span></td></tr><tr valign='top'><td rowspan='3' bgcolor='#F8F6F7'> </td><td valign='top' class='bodycopyblack'><a href='http://www.somedomain.com/read_more.php?type=newsletter&id=$row[id]'>read more</a><br><br><a href='http://www.somedomain.com/unsubscribe_newsletter.php' target='_blank'>unsubscribe to newsletter</a></td></tr><tr valign='top'><td><p class='bodycopy-black'><em><br>blah blah disclaimer</td></tr><tr valign='top'><td> </td></tr></table></html>\r\n";
// start the second boundary
$hdr .= "--MYBOUNDRY-123\r\n";
$hdr .= "Content-Type:$filetype;";
$hdr .= "name=\"$file_name\"\r\n";
$hdr .= "Content-Transfer-Encoding:base64\r\n";
$hdr .= "Content-ID : media1256\r\n";
$hdr .= "Content-Disposition:attachment;";
$hdr .= "filename=\"$file\"\r\n\n";
$hdr .= "$fileinc\r\n";
// start the fourth boundary
$hdr .= "--MYBOUNDRY-123\r\n";
$hdr .= "Content-Type:$filetype3;";
$hdr .= "name=\"$file3_name\"\r\n";
$hdr .= "Content-Transfer-Encoding:base64\r\n";
$hdr .= "Content-ID : media1258\r\n";
$hdr .= "Content-Disposition:attachment;";
$hdr .= "filename=\"$file3\"\r\n\n";
$hdr .= "$fileinc3\r\n";
// start the third boundary
$hdr .= "--MYBOUNDRY-123\r\n";
$hdr .= "Content-Type:$filetype2;";
$hdr .= "name=\"$file2_name\"\r\n";
$hdr .= "Content-Transfer-Encoding:base64\r\n";
$hdr .= "Content-ID : media1257\r\n";
$hdr .= "Content-Disposition:attachment;";
$hdr .= "filename=\"$file2\"\r\n\n";
$hdr .= "$fileinc2";
$hdr .= "--MYBOUNDRY-12388--";
$sql3 = "SELECT email FROM newsletter_subscribers";
$rs3 = mysql_query($sql3, $conn);
while ($row2 = mysql_fetch_array($rs3)) {
$re = "Some- Newsletter";
$filename .= "sent to : ".$row2['email']."<br>";
mail($row2['email'],$re,"",$hdr);
} //end of while
//header("Location:someurl");
exit();
}
any help or ideas would be great.