spamoom Posted June 21, 2007 Share Posted June 21, 2007 I have made a simple newsletter for one of my customers, and have recently found out that it does not allow html. I am sure it should... here is the code <?php } else { $title = $_POST['title']; $message = $_POST['message']; $query = $db->query("SELECT * FROM newsletter"); $fetch = $db->fetch($query); while ($fetch) { mail ($fetch['email'], $title, $message, 'From: webmaster@example.com'); echo "Sent to ".$fetch['email']."\n"; $fetch = $db->fetch($query); } } ?> Any Ideas? Quote Link to comment https://forums.phpfreaks.com/topic/56543-solved-email/ Share on other sites More sharing options...
trq Posted June 21, 2007 Share Posted June 21, 2007 I am sure it should Nope. It definately doesn't. Quote Link to comment https://forums.phpfreaks.com/topic/56543-solved-email/#findComment-279254 Share on other sites More sharing options...
spamoom Posted June 21, 2007 Author Share Posted June 21, 2007 Please could you tell me how I could get it to send html emails? as Nope. It definately doesn't. Don't really help Quote Link to comment https://forums.phpfreaks.com/topic/56543-solved-email/#findComment-279265 Share on other sites More sharing options...
trq Posted June 21, 2007 Share Posted June 21, 2007 You just need to add the mimetype to your headers. <?php } else { $title = $_POST['title']; $message = $_POST['message']; $query = $db->query("SELECT * FROM newsletter"); $fetch = $db->fetch($query); $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= 'From: webmaster@example.com'; while ($fetch) { mail ($fetch['email'], $title, $message, $headers); echo "Sent to ".$fetch['email']."\n"; $fetch = $db->fetch($query); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/56543-solved-email/#findComment-279270 Share on other sites More sharing options...
chrisuk Posted June 21, 2007 Share Posted June 21, 2007 yup, all about the headers! Change that, and bob's your uncle Quote Link to comment https://forums.phpfreaks.com/topic/56543-solved-email/#findComment-279273 Share on other sites More sharing options...
spamoom Posted June 21, 2007 Author Share Posted June 21, 2007 Thanks very much. Had no idea that was needed . Quote Link to comment https://forums.phpfreaks.com/topic/56543-solved-email/#findComment-279328 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.