Hi
I am getting an error while sending a mail from a form
Failed to connect to mailserver at "mail.yoursite.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\xampp\htdocs\send.php on line 8
Warning: mail() [function.mail]: SMTP server response: 550 ACCESS DENIED in C:\xampp\xampp\htdocs\send.php on line 9
Message delivery failed...
here is the code
mail.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>Untitled Document</title>
</head>
<body>
<form action="send.php" action="POST">
Enter Name : <input type="text" name="name" />
Enter E-Mail : <input type="text" name="email" />
Enter Subject: <input type="text" name="subject" />
Enter Message: <input type="text" name="mess" />
<input type="submit" name="Submit" />
</form>
<?php
?>
</body>
</html>
send.php
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$body = $_POST['subject'];
$message=$_POST['message'];
//ini_set("sendmail_from","[email protected]");
//ini_set("SMTP","mail.yoursite.com");
mail("[email protected]", $name, $message, "From :$from");
if (mail('[email protected]', $name, $body, $message, "From :$from")) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>