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

  • SEARCH
  • Home
  • 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 7888213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:46:34+00:00 2026-06-03T05:46:34+00:00

I have a little problem with the following code. When I click Send it

  • 0

I have a little problem with the following code. When I click “Send” it says “PHP Warning: mail() [function.mail]: “sendmail_from” not set in php.ini or custom “From:” header missing in C:***.com**\mail.php on line 21″

This is the jQuery:

$(document).ready(function(){
$("#send").click(function(){


    var valid = '';
    var isr = ' requested.</h6>';
    var name = $("#name").val();
    var mail = $("#email").val();
    var messaggio = $("#message").val();

    if (name.length<1) {
        valid += '<h6>A valid name is'+isr;
    }
    if (!mail.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/i)) {
        valid += '<h6>A valid e-mail address is'+isr;
    }


    if (valid!='') {
        $("#re").fadeIn("slow");
        $("#re").html("<h6><b>Error:</b></h6>"+valid);
        $("#re").css("background-color","#ffc0c0");
    }

    else {
        var datastr ='name=' + name + '&mail=' + mail + '&messaggio=' + encodeURIComponent(messaggio);
        $("#re").css("display", "block");
        $("#re").css("background-color","#FFFFA0");
        $("#re").html("<h6>Sending..</h6>");
        $("#re").fadeIn("slow");
        setTimeout("send('"+datastr+"')",2000);
    }
    return false;
});
});

function send(datastr){
    $.ajax({    
        type: "POST",
        url: "mail.php",
        data: datastr,
        cache: false,
        success: function(html){
        $("#re").fadeIn("slow");
        $("#re").html(html);
        $("#re").css("background-color","#e1ffc0");
        setTimeout('$("#re").fadeOut("slow")',2000);
    }
    });
}

And the PHP

<?php
$mail = $_POST['mail'];
$name = $_POST['name'];
$text = $_POST['messaggio'];
$ip = $_SERVER['REMOTE_ADDR'];

$to = "admin@****.com";

$message = "E-mail received from: ".$name.", ".$mail.".<br />";
$message .= "Messaggio: <br />".$text."<br /><br />";
$message .= "IP: ".$ip."<br />";
$headers = "From: $mail \n";
$headers .= "Reply-To: $mail \n";
$headers .= "MIME-Version: 1.0 \n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1 \n";

 if(mail($to, $message, $headers)){
    echo "<h6>Message sent.</h6>";
}

else{ 
    echo "<h6>Ops! We've got a problem! :(</h6>";
}
?>

The mentioned line is “if(mail($to, $message, $headers)){” but I don’t understand the error.

I am using the same code on another website (another domain also) and it runs without problems.

  • 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-06-03T05:46:35+00:00Added an answer on June 3, 2026 at 5:46 am

    Have you checked the SMTP Settings in PHP.INI?

    Set this in your code or in your php.ini:

      <?php 
         ini_set("SMTP","smtp-server-address" ); 
         ini_set('sendmail_from', 'from-email-address'); 
       ?> 
    

    And if you are sending through a different port than 25, you can also override the default:

       ini_set('smtp_port', '2525'); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My problem is a little bit complex. I have the following code: $(document).ready(function() {
I have a little problem with following VHDL code: process (zbroji) begin if rising_edge(zbroji)
I have run into a rather weird little problem. In the following code I
Hello i'm practising C and i have a little problem with the following code.
I am having a little problem with the following code: <?php class appointments {
I am little bit confused about following problem & their solutions: i have 2
I have a little problem with simulating a click with javascript. I'm aware of
I have a little problem with some jquery and http://www.mikage.to/jquery/jquery_history_noc.html The function works great,
I have a little problem regarding arranging of code, which depends on each other
i have a little big problem. My problem is the following. I´ve got two

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.