I am pulling information from a database, and trying to send it as an email. There will be multiple rows of data pulled from the database. This is what my code looks like...
<?php
$to = "--";
$subject = "Test mail";
$message .= "This Week's Memo: ";
while ($row = mysqli_fetch_assoc($result)){
$message .= $row["first_name"];
$message .= (date ('F-d ', strtotime($row["time"])));
$message .= $row["title"];
$message .= $row["memo"];
};
$from = "--";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
All of the info mails fine. My problem is, I would like to keep the breaks in. For instance after the title, I would like a break, and then the memo info to start. Any ideas I could take a look at how to achieve? Thanks for any help.
please let me know if more info is needed. thanks!
Just add it. Concatenate a new line after your title
$message .= $row["title"] ."
";
As side note I would suggest you to start declaring message variable and then concatenate the other strings
$message = "This Week's Memo: ";
//^ no dot at first declaration
try:
$message .= $row["title"].'<br/>';
$message .= $row["memo"];
use PHP_EOL to work on different OS
$message .= $row["title"].PHP_EOL;