使用Ajax发送电子邮件

                <div class="grid--cell fl1 lh-lg">
                    <div class="grid--cell fl1 lh-lg">
                        It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and   cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,   <a href="/help/reopen-questions">visit the help center</a>.

                    </div>
                </div>
            </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2012-11-26 12:23:06Z" class="relativetime">7 years ago</span>.</div>
        </div>
    </aside>

I am using following to send an email through ajax. It's not sending name.

var submitForm = function(){
                var name = jQuery('[name=name]').val();
                var email = jQuery('[name=email]').val();
                var gender = jQuery('[name=gender]').val();
$.ajax({
                    url: 'http://domainname.com/Email.php',
                    data: {name: name, email: email, phone: phone, gender: gender},
                    type: 'POST',
                    success: function ( data ) {
                        $(".rhino-container").html("Dear <b>"+name+"</b> You have applied successfully, Our career counseller will get in touch with you."); 
                    }
                });

            };

Below is email.php:

<?php
    $name = $_POST['name'];
    $email = $_POST['email'];
    $gender = $_POST['gender'];
    $to = 'yourdomain@gmail.com';
    $from = $email;
    $subject = 'Apply Online Details from a user as below---';
    $body = "Hello Admin<br><br>
            Name: <strong>$name</strong><br>
            Email: $email<br>
            Phone: $phone<br>
            Gender: $gender<br>
                ";
    $headers  = 'MIME-Version: 1.0' . "
";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
    $headers .= "From: $from";
    $ok = mail($to, $subject, $body, $headers);
    if($ok)
        echo '1';
    else
        echo '0';
?>
</div>

Each line should be separated with a LF ( ). Lines should not be larger than 70 characters. Dont use breaks.

Besides that, have you tried sending an email on your server? Straight php with no ajax? Maybe your mail is not setup correctly, atleast try it out.

Also use selectors in jQuery, I haven't seen your html, but do something like

var name = $('#name').val();

Good luck.

var submitForm = function () {
    var name = $('input[name="name"]').val();
    var email = $('input[name="email"]').val();
    var phone = $('input[name="phone"]').val();
    var gender = $('input[name="gender"]').val();

    var param = {
        "name": name,
            "email": email,
            "phone": phone,
            "gender": gender
    };

    $.ajax({
        url: 'http://domainname.com/Email.php',
        data: param,
        type: 'POST',
        dataType: json,
        success: function (data) {
            if (data.status) {
                $(".rhino-container").html("Dear <b>" + name + "</b> You have applied successfully, Our career counseller will get in touch with you.");
            } else {
                $(".rhino-container").html("Something went wrong");
            }
        }
    });

};

Please use this PHP for Server Side.

header('Content-type: application/json'); echo $ok ? json_encode(array("status" => true)) : json_encode("status" => false));