Sending email error

Sending email from website contact form gives error

Page 1 of 1

1 Replies - 2391 Views - Last Post: 23 February 2010 - 11:52 PM Rate Topic: -----

#1 afridi2129  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 04-November 07

Sending email error

Posted 23 February 2010 - 11:43 PM

hello everyone. i asked this question some days ago but no one had given me a solution for this thing:(.

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>


Is This A Good Question/Topic? 0
  • +

Replies To: Sending email error

#2 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5388
  • View blog
  • Posts: 27,383
  • Joined: 10-May 07

Re: Sending email error

Posted 23 February 2010 - 11:52 PM

Judging that error message, looks like you'll have to use SMTP authentication style email rather than the PHP function provided one.

To be sure, you could contact your host.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1