0

Hi there,

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

<?php
$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 />"
$yphone;
$headers = "From: $email";

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

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

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

This does not work, help please!

Thank you!
Bouh

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by bouhbob
0

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

Edited by ZZZubec: n/a

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.