yasirjamal
03-12-2009, 03:04 PM
Dear Friends,
I am getting problem during sending email. Before the same code was working. But now i am receiving this error.
Notice: Undefined variable: fname_field in E:\Sites\Single5\starlinks\webroot\mailer.php on line 6
Notice: Undefined variable: headers in E:\Sites\Single5\starlinks\webroot\mailer.php on line 6
Notice: Undefined index: message in E:\Sites\Single5\starlinks\webroot\mailer.php on line 12
Notice: Undefined index: lastname in E:\Sites\Single5\starlinks\webroot\mailer.php on line 13
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 31
My php mail script is below please have a look.
<?php
if(isset($_POST['submit'])) {
$to = "yasir.jamal.co.cc";
$subject = "From DSR Website";
$headers.= "From: $fname_field\r\n";
$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";
if (mail($to, $subject, $body, $headers)) {
header ("Location: http://www.yasirjamal.com/Email sent.html");
}
} else {
echo "blarg!";
}
?>
I am getting problem during sending email. Before the same code was working. But now i am receiving this error.
Notice: Undefined variable: fname_field in E:\Sites\Single5\starlinks\webroot\mailer.php on line 6
Notice: Undefined variable: headers in E:\Sites\Single5\starlinks\webroot\mailer.php on line 6
Notice: Undefined index: message in E:\Sites\Single5\starlinks\webroot\mailer.php on line 12
Notice: Undefined index: lastname in E:\Sites\Single5\starlinks\webroot\mailer.php on line 13
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 31
My php mail script is below please have a look.
<?php
if(isset($_POST['submit'])) {
$to = "yasir.jamal.co.cc";
$subject = "From DSR Website";
$headers.= "From: $fname_field\r\n";
$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";
if (mail($to, $subject, $body, $headers)) {
header ("Location: http://www.yasirjamal.com/Email sent.html");
}
} else {
echo "blarg!";
}
?>