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 = "lol@gmail.com";
$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
Share on other sites

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

$to = "lol@gmail.com";
$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!";
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.