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: [email protected]'); echo "Sent to ".$fetch['email']."\n"; $fetch = $db->fetch($query); } } ?> Any Ideas? 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. 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 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: [email protected]'; while ($fetch) { mail ($fetch['email'], $title, $message, $headers); echo "Sent to ".$fetch['email']."\n"; $fetch = $db->fetch($query); } } ?> 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 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 . Link to comment https://forums.phpfreaks.com/topic/56543-solved-email/#findComment-279328 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.