aebstract Posted October 7, 2008 Share Posted October 7, 2008 Here is my mail script, runs on a cron job once a week. <?php set_time_limit(0); mysql_connect("localhost","***","***") or die(mysql_error()); mysql_select_db("**_*_*"); $i = 1; while ($i != 0){ $myquery = mysql_query("SELECT * FROM mailer ORDER BY RAND() LIMIT 1") or DIE(mysql_error()); while($r=mysql_fetch_array($myquery)) { $id=$r["id"]; $flyer=$r["flyer"]; $date=$r["date"]; $used=$r["used"]; } if ($used == 0) { $i = 0; mysql_query("UPDATE mailer SET used='1' WHERE id=$id LIMIT 1") or DIE(mysql_error()); } } include "../eq$flyer.php"; $content = str_replace('class="contacttd"', 'bgcolor="c0c0c0" cellpadding="5"', $content); $content = str_replace('class="contacttd2"', 'bgcolor="dddddd" cellpadding="5"', $content); $content = str_replace('<h2>', '<h2 style=italic .5em Georgia, Times, serif;>', $content); $message = "<html><head></head><body>$content</body></html>"; $fromaddress = 'admin@berryequipment.net'; $emailsubject = 'Berry Plumbing & Equipment - Product Information'; $emails = array("lots of emails"); $emailaddress = array_unique($emails); $i = count($emailaddress); $z = 0; if ($i != 0){ while ($i != $z){ mail($emailaddress[$z], $emailsubject, $message, "From: " .$fromaddress. "\nX-Mailer: PHP 4.x"); $z++; } } ?> Problem is, this is the email that I received: <html><head></head><body></body></html> I thought it was all correct so that it would put the content in to the email but I must have messed something up. Quote Link to comment Share on other sites More sharing options...
Brandon Jaeger Posted October 7, 2008 Share Posted October 7, 2008 I'm not sure if this is what's causing it, but try putting quotes around the style: <h2 style="italic .5em Georgia, Times, serif;"> Quote Link to comment Share on other sites More sharing options...
Bendude14 Posted October 7, 2008 Share Posted October 7, 2008 try changing $content = to $content .= for the second two values... Quote Link to comment Share on other sites More sharing options...
trq Posted October 7, 2008 Share Posted October 7, 2008 You need to set some html headers. This... mail($emailaddress[$z], $emailsubject, $message, "From: " .$fromaddress. "\nX-Mailer: PHP 4.x"); ought be replaced by... $headers = "From: $fromaddress\r\n"; $headers .= "Content-type: text/html\r\n"; mail($emailaddress[$z], $emailsubject, $message, $headers); Quote Link to comment Share on other sites More sharing options...
Bendude14 Posted October 7, 2008 Share Posted October 7, 2008 thats why he is an admin lol... i never thought of that Ps congrats on your promotion from Global Mod keep up the good work mate Quote Link to comment Share on other sites More sharing options...
aebstract Posted October 7, 2008 Author Share Posted October 7, 2008 I'm not sure if this is what's causing it, but try putting quotes around the style: <h2 style="italic .5em Georgia, Times, serif;"> Even if the style wasn't right, it would still display the text/information without styling. try changing $content = to $content .= for the second two values... I'm running a str_replace on my entire $content variable and replacing parts of it, not adding to it so the .= would have no working effect towards fixing the problem. That leaves us with thorpe, I tossed your code in and it works Thanks a bunch man. edit: did they remove the topic solved feature?! Quote Link to comment Share on other sites More sharing options...
Bendude14 Posted October 7, 2008 Share Posted October 7, 2008 yer your right sorry.... Yup it does seem to have disappeared ... don't no why though Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.