I am attempting to corporate delivering email before posted the shape in wordpress page. I am able to perform the AJAX part and send email effectively. However, the e-mail isn't 100% shipped. I question why?

This is actually the code

    var data = 

    data.donorEmail = $("#email").val()

    data.action = "mail_action"

    $("#donorSubmit").click(function(e)publish('http://www.myurl.com/wordpress-admin/admin-ajax.php',data, onSuccess)


    function onSuccess(results)


Which is the code in functions.php

add_action('wp_ajax_mail_action', 'sending_mail')

add_action('wp_ajax_nopriv_mail_action', 'sending_mail')

function delivering_mail()Publish['email']))


        if(mail($to, $subject, $message))



With this particular code I get the email constantly. However, this content from the email which ought to be the email of user does not include the e-mail constantly. Sometime it is simply an empty content.

While you help you make:

vardata = {'donorEmail':$('#email').val(),'action':'mail_action' };

however in your php file you request the $_POST['email'] rather than $_POST['donorEmail'];

try calling $_POST['donorEmail'];