Hi Everyone,
i need urgent help from you.iam trying to send mail using php mail() functions.iam using XAMPP server.if i run above code iam getting "succesfuuly sent" message as a output but iam not getting any mail in my inbox address.please help methis is my code.

$message="hi $name.you are $age years old.and your current address is $address.";
echo "succesfully sent";
echo "try again";

<form action="mail.php" method="POST">

Name:<input type="text" name="name" required>
Age:<input type="number" name="age" required>
Adress:<input type="text" name="address" required>
Comment:<textarea row="4" col="10" name="comment"></textarea><br />
<input type="submit" name="submit" value="submit">

Edited by pritaeas: Removed your email address to avoid spam.

2 Years
Discussion Span
Last Post by almostbob


at basic you should include the headers to define From and Reply-To, check example 2 of the documentation:

Where From is one of your emails and Reply-To the sender email and you will need a mailer application to send the message, like sendmail which is usually installed on linux and mac platforms. For windows I have no idea of which local solution you could use (maybe sendmail in cygwin?)

Additionally if your email requires the connection to an SMTP then mail() is not the best approach.

Pay attention to this point: if you're working on a script that will run on a remote server then check the hosting documentation (or ask to the support) if SMTP is required when sending an email from the registered domain. In that case read this thread:

In case the From header is populated by a gmail account, then SMTP is required, by not authenticating the script will fail.

And do a search on Daniweb, this argument has been discussed a lot of times.


I would suggest you look at SwiftMailer (my fav) or PHPMailer to send mails. For all practical purposes I don't use PHP mail()

Here's a sample from Documetation

require_once 'lib/swift_required.php';

// Create the Transport
$transport = Swift_SmtpTransport::newInstance('smtp.example.org', 25)
  ->setUsername('your username')
  ->setPassword('your password')

// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);

// Create a message
$message = Swift_Message::newInstance('Wonderful Subject')
  ->setFrom(array('john@doe.com' => 'John Doe'))
  ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
  ->setBody('Here is the message itself')

// Send the message
$result = $mailer->send($message);

The obvious one, already mentioned
Xampp does not install mail servers, there is no facility to send mail from localhost
There is no error returned from a non-existent server so error checking does not respond as error
I like swiftmailer too

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.