wright67uk Posted February 7, 2011 Share Posted February 7, 2011 The code below returns the correct results, which are in this case are email addresses. After each displayed value there is a br eg. [email protected]<br>[email protected]<br>email3@ etc. So the quesion is, can i change the below codeing to prevent this. I have tried changing $message .= "<br>". $row['email'] to $message .= "\n". $row['email'] but this results in; Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html $code = $_GET['postcode']; $message = $_GET['message']; $emailad = "[email protected]"; $shortcode = substr($code,0,2); $result = mysql_query("SELECT email FROM treesurgeons WHERE postcode like '%" . $shortcode . "%' ORDER BY companyName LIMIT 3") or die(mysql_error()); echo "<h2>Business Names:</h2>"; while ($row = mysql_fetch_array( $result )) { $message .= "<br>". $row['email'] ; } echo "\n"; echo $message; mail( "$emailad", "Header","$message" ); echo "<br>" . "Thank you for using our mail form."; Link to comment https://forums.phpfreaks.com/topic/226930-using-n-instead-of-causes-errors/ Share on other sites More sharing options...
btherl Posted February 7, 2011 Share Posted February 7, 2011 Try using "\r\n" instead of "\n" Link to comment https://forums.phpfreaks.com/topic/226930-using-n-instead-of-causes-errors/#findComment-1170896 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.