Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1041843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:24:54+00:00 2026-05-16T15:24:54+00:00

i am posting to a mailer.php file. mailer.php <?php if(isset($_POST[‘submit’])) { $to = testabc@gmail.com;

  • 0

i am posting to a mailer.php file.
mailer.php

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

$to = "testabc@gmail.com";
$subject = "Contact via website";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];

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

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

} else {

echo "blarg!";

}
?>

here is my js code

$('.submit').click(function(){
            $('span.msg').css({'visibility': 'visible'}).text('Sending...');
            $.post("mailer.php", $(".contactPage").serialize(),
                function(data){
                    $('span.msg').text('Your Message has been received. Thank you').show();
                });

            return false;    
        });

I am getting message of success but email is not received. What i am doing wrong? How to get error detail from mailer.php file and showing in span.msg?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:24:55+00:00Added an answer on May 16, 2026 at 3:24 pm
    if(mail($to, $subject, $body)){
      echo "success";
    }else{
      echo "fail";
    }
    

    JS:

    $('.submit').click(function(){
                $('span.msg').css({'visibility': 'visible'}).text('Sending...');
                $.post("mailer.php", $(".contactPage").serialize(),
                    function(data){
                        if(data == 'success'){
                          $('span.msg').text('Your Message has been received. Thank you').show();
                        }else{
                          $('span.msg').text('Your Message has failed. Thank you').show(); 
                        }                       
                    });
    
                return false;    
           });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im posting html to my upload.php file and im escaping is in jquery but
When posting a form with a file upload box using document.forms[0].submit() on ie 9
I am posting numeric value by a form and in php file use var_dump(is_int($my_var));
When posting from JS, PHP (5.3.8) returns some line returns in excess. For example:
I am posting a simple form in codeigniter. When I submit the form and
I'm programatically posting a form to a PHP form handling script. Is there a
When posting a link directly to a Tab on a Facebook Page, https://www.facebook.com/PAGENAME?sk=app_APPID Facebook
I'm posting a JPEG file from a HTML5 canvas element as a string to
Posting a stack overflow question on stackoverflow.com, how amusing :-) I'm running some recursive
When posting the following request https://graph.facebook.com/oauth/access_token?oauth_version=1.0&oauth_nonce=5887e5b11904194f7d217e9b7f795d62&oauth_timestamp=1317623602,&oauth_consumer_key=607197622 &oauth_token=AQD8Y6xnKqRYThyLowBETEx5-fyr_cqVcmvItdnfgv01B24_WA0ykwRmkJgG6cyQgEJpyXQLIEauF0B24p8oqffoO-brGa2V1H9gASlAazKwOv65CvlbvGsEGd0Dk2VC58iiKGgB7xo7Rf4nL-V-G_buB_nNaHsyLHJJp-j2Rg9_4fmBmic74QrS1VIedU4W5-Sb2K-8oNh8a--mi9lIIyah#_=_&oauth_signature_method=HMAC-SHA1&oauth_signature=96be7526390b287e7a32d &redirect_uri=https://apps.facebook.com/mymegha/ getting the following error { error:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.