通过邮件发送div内容

i have a form with inputs for name and mail. The Code looks like this:

<form role="form" method="post" action="email.php">
   <input type="text" class="sendmail" name="name" placeholder="Your name" />
   <input type="text" class="sendmail" name="email" placeholder="Your email" />
</form>

Additionally i need to pass some div content (.inner) to the .php mailer. Code looks like this:

$(function() {
  $('.send').click(function(e) {
        $.ajax({
              url: 'email.php',
              type: 'POST',
              data: {'message': $('.inner').html()},
              success: function (data) {
                    alert('You data has been successfully e-mailed');
              }
        });
    });
});

The .php mailer:

$email = $_POST['email'];
$subject = "Subject";
$name = $_POST['name'];
$content = $_POST['message'];

$to = 'my@email.com';

$test = '
        <html>
        <head>
          <title>Email: '. $email .'</title>
        </head>
        <body>
            <p>Von: '. $name .'</p>
          <div>
            '. $content .'
          </div>
        </body>
        </html>
        ';

$headers  = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=utf-8' . "
";
$headers .= "From: $email
";

mail($to, $subject, $test, $headers); 

After submitting i'll get an email with only the ajax script submitted $_POST['message']; .. $email and $name wont show, not in the $test area nor will the email be displayed in the mail header. My guess is that the ajax script overrides the "normal" form submit? For some help and insights i would be grateful.

In your data you are sending only message:

data: {
  'message': $('.inner').html()
},

You can check what all has been sent by putting a var_dump():

var_dump($_POST);

You need to add the others too to get there. I believe you should have got the error saying, undefined index. So change it to:

data: {
  'message': $('.inner').html(),
  'email':   $('[name="email"]').val(),
  'name':    $('[name="name"]').val()
},

Finally, your full code should be like:

$(function() {
  $('.send').click(function(e) {
    $.ajax({
      url: 'email.php',
      type: 'POST',
      data: {
        'message': $('.inner').html(),
        'email':   $('[name="email"]').val(),
        'name':    $('[name="name"]').val()
      },
      success: function(data) {
        alert('You data has been successfully e-mailed');
      }
    });
  });
});