PHP Mail
Posted: Thu Mar 12, 2009 10:36 am
Dear Friends,
I am new to php. I dont no how to set SMTP. i am receiving this error
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in E:\Sites\Single5\starlinks\webroot\mailer.php on line 29.
Please help me to solve this problem. my code is.
I am new to php. I dont no how to set SMTP. i am receiving this error
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in E:\Sites\Single5\starlinks\webroot\mailer.php on line 29.
Please help me to solve this problem. my code is.
Code: Select all
<?php
if(isset($_POST['submit'])) {
$fname_field = $_POST['firstname'];
$lname_field = $_POST['lname'];
$city = $_POST['city'];
$occupation = $_POST['occupation'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$option = $_POST['lastname'];
$comment = $_POST['comment'];
$telephone = $_POST['telephone'];
$mob = $_POST['mobile'];
$dropdown = $_POST['interstedin'];
$body = "
First Name: $fname_field\n
Last Name: $lname_field\n
E-Mail: $email_field\n
Intersted In: $dropdown\n
City : $city\n
Occupation : $occupation\n
Telephone : $telephone\n
Mobile : $mob\n
Message: $comment\n";
$to = "yasir.jamal@rocketmail.com";
$subject = "From DSR Website";
$headers = "From: $fname_field\r\n";
if (mail($to, $subject, $body, $headers)) {
header ("Location: http://www.yasirjamal.com/Email sent.html");
}
} else {
echo "blarg!";
}
?>