Jump to content

Changing email structure


Buttero

Recommended Posts

Hey guys!

 

I've just got a contact script working, but when I recive the email, all the info is hard to distinguish visually. e.g:

 

From:nameEmail:emailMessage:message

 

It displays like that, does anyone know how to seperate them all? I tried to wrap each of them in <p> tags, but that just showed up as text in the email.

 

Here is the code:

 

<?php
if(isset($_POST['submit'])) {

$to = "[email protected]";
$subject = "Contact";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];

$body = 
"From: $name_field
E-Mail: $email_field
Message:\n $message";

echo "Data has been submitted to $to!";
mail($to, $subject, $body);

} else {

echo "blarg!";

}
?>

 

Any help would be greatly apprichiated,

 

Thanks  :)

Link to comment
https://forums.phpfreaks.com/topic/36977-changing-email-structure/
Share on other sites

<?php
if(isset($_POST['submit'])) {

$to = "[email protected]";
$subject = "Contact";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];

$body = "From: $name_field \r\n
E-Mail: $email_field \r\n
Message:\n $message \r\n";

echo "Data has been submitted to $to!";
mail($to, $subject, $body);

} else {
echo "blarg!";
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.