Newline in PHP email

  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Posts: 854

Post 3+ Months Ago

I've tried everything I can personally think of to create a new line in my email being sent from php. "\n", "\r", "<br>" all end up being part of the email text rather than new lines. Anyone know what the issue is? Here's the part of the script that sends the message:


PHP Code: [ Select ]
   $message = '';
   foreach($inputs as $val)
      $message .= '\n' . $val;
   if(mail($this->to, $inputs['subject'], $message) )
      echo 'Thank you, I\'ll get back to you real soon!';
 
  1.    $message = '';
  2.    foreach($inputs as $val)
  3.       $message .= '\n' . $val;
  4.    if(mail($this->to, $inputs['subject'], $message) )
  5.       echo 'Thank you, I\'ll get back to you real soon!';
  6.  
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Posts: 854

Post 3+ Months Ago

Nevermind...I just figured it out. It's because I was using single quotes rather than double quotes in my foreach statement.

Why is it I get stuck on something for 2 days, and then post here and figure it out in seconds? I should post on here more often hahaha.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

I learn quicker under public scrutiny too. I think the pressure of looking like a moron makes us forget the distracting elements of our lives and focus on the task at hand. :)
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

Also, it's a pretty common thing for people to find their own bugs when explaining a problem to others. Much of it is because when you're examining your own code, you're operating with a bunch of assumptions that cause you to overlook or miss things. When you need to explain something to someone else, you drop the assumptions and end up seeing the issue yourself.
  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Posts: 854

Post 3+ Months Ago

Totally agree spork - unfortunately the rubber ducky debugging method hasn't worked for me. Apparently needs to be a real person for some reason. Even someone who has absolutely no idea what I'm talking about. Seems to work well for me nearly every time.

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 118 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.