1

the file is entitled as frontend.php

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mail</title>
</head>

<body>
<form method="post" action="backend.php">
  <label>To</label>
  <input type="email" name="reciever">
  <br>
  <label>Subject</label>
  <input type="text" name="subject">
  <br>
  <label>Message</label>
  <input type="text" name="message"/>
  <br>
  <input type="submit" value="Send Mail" name="sendMail" />
</form>
</body>
</html>

and this file is named as "backend.php"

<?php

$from = "waqas.sajid.ncm@gmail.com";
$email=$_POST['reciever'];
$subject=$_POST['subject'];
$messge=$_POST['message'];
ini_set("SMTP","aspmx.l.google.com");
mail($email, $subject, $messge, "From:".$from);

?>

but its not working...why? and XAMPP is being used.

Jothi Kannan
  • 3,320
  • 6
  • 40
  • 77

1 Answers1

0

Lolx, you can't simply send email form this general method in xampp or local server... Upload your code on live server and than check it....

Local server don't allow to send email.. you either need some other server or make your code live...

DeDevelopers
  • 581
  • 1
  • 7
  • 25
  • What if I say I have been doing this and it was working and I have got mails in my Spam and junk folders. Actually problem is in php.ini configuration if you can help out. – Waqas Sajid Oct 01 '14 at 11:31