i m using a contact.php with some html fields to send email from website to my email address. but i always get this error.
"Warning: mail() [function.mail]: SMTP server response: 530 SMTP authentication is required. in C:\inetpub\vhosts\jkgroup.com.pk\httpdocs\contact.php on line 35
ERROR!"
the code which i m using is contact.php:
<?php
if(!$_POST) exit;
$email = $_POST['email'];
//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email ))
{
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('name','email','phone','concerning','message');
$required = array('name','email','message');
$your_email = "nisarkhan_11@hotmail.com";
$email_subject = "JK_Contactus";
$email_content = ":\n";
foreach($values as $value){
if(in_array($value,$required)){
if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
$email_content .= $value.': '.$_POST[$value]."\n";
}
}
$smtp_server = $_POST['mail.jkgroup.com.pk'];
$smtp_port = $_POST['2525'];
if(mail($your_email,$email_subject,$email_content))
{
echo 'Message sent!';
} else {
echo 'ERROR!';
}
}
?>
also this is html code:
<form action="contact.php" method="post" id="contactform" style="width: 502px">
<ol>
<li>
<label for="name">Your Name*<br />
<span>Add your name </span></label>
<input id="name" name="name" class="text" />
</li>
<li>
<label for="email">Your Email Address*<br />
<span> Add a valid address</span></label>
<input id="email" name="email" class="text" />
</li>
<li style="width: 466px">
<label for="message">Your Message*<br />
<span> Communicate with us</span></label>
<textarea id="message" name="message" rows="6" cols="50"></textarea>
</li>
<li class="buttons" style="width: 465px">
<input type="submit" value="Send Message" id="submit" />
</li>
</ol>
</form>

New Topic/Question
Reply




MultiQuote



|