Hi there,

here is my code and I don't know how to add <br /> to get a return in the email received:

$to = "myemail@gmail.com";
$subject = "From the website";
$email = $_REQUEST['email'] ;
$yname = $_REQUEST['name'] ;
$ycompany = $_REQUEST['company'] ;
$yphone = $_REQUEST['phone'] ;
$ymessage = $_REQUEST['message'] ;
$ywebsite = $_REQUEST['website'] ;
$message = $ymessage ."<br />"
$ywebsite ."<br />"
$yname ."<br />"
$ycompany ."<br />"
$headers = "From: $email";

if(($email=="") or ($message=="")){
	print "Sorry, you forgot to write your email or your message. ";
$sent = mail($to, $subject, $message, $headers) ;

{print "Your mail was sent successfully, we will get back to you soon. <br />Thank you."; }
{print "We encountered an error sending your mail"; }

Check the $message where I add like:
$message = $ymessage ."<br />"
$ywebsite ."<br />"
$yname ."<br />"
$ycompany ."<br />"

This does not work, help please!

Thank you!

Recommended Answers

All 2 Replies

just use "<br/>\r\n" or only "\r\n" (if plaintext message)

Thank you so much ZZZubec, I couldn't find an answer online! It works!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.