Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7420199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:11:56+00:00 2026-05-29T08:11:56+00:00

I’ve created a very simple PHP system to send emails to a mailinglist using

  • 0

I’ve created a very simple PHP system to send emails to a mailinglist using a MySQL database and PHP. It’s not finished yet and as mails sent through the mail() function go into the junk-folder in most mailing programs straight away, I’ll connect to my SMTP server using PHP in the future. Though there’s something that I’d like to solve first.

<table border="0">
<form method="post" action="send.php">
<tr><td>Onderwerp:</td><td><input type="text" style="width:200px;" name="sub" /></td></tr>
<tr><td>Bericht:</td><td><textarea name="mes" style="width:200px; height:100px;"></textarea></td></tr>
<tr><td></td><td><input type="submit" style="width:200px;" value="Verzend" /></td></tr>
</form>
</table>

When a message is filled in in the above textarea it is submitted to the following script (send.php):

while($row = mysql_fetch_array($result)){
$to      = $row['email'];
$subject = $_POST['sub'];
$message = $_POST['mes'];
$headers = 'From: from@from.com>' .  "\r\n" . 'Reply-To: reply@reply.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

mail($to, $subject, $message, $headers);
}

Of course there’s some more script above this to connect to the db etc., but that’s not relevant here. As you can see, the message text received through $_POST is put into a variable used in the mail() function.

But when I use multiple lines in the textarea, at some point in the script this is all converted into one huge line which will create a messy email in the end. As some of you might have seen, I’ve already created a header that says the mail’s content is HTML. This is because I put a <p> element around the text sent through $_POST. I tried to remove this as it might be the thing converting it all into one line. But this didn’t help.

Of course you can use <br /> in HTML, but it would be silly to ask all the users of the list to use that to create a new line. So: Is there a way to make the multiple lines remain in the email without having to fill in anything different in the textfield?

Thanks for answering in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:11:56+00:00Added an answer on May 29, 2026 at 8:11 am

    Perhaps ypu are looking for nl2br function in php..

    $message = nl2br($_POST['mes']);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.