2017-01-05 23 views
-2

Iam beginner in PHP programming。コードの検索のロットから は、私はこれは私の連絡先フォームとPHPコードがメールでもその特定のメールに行くのではありませんウェブサイトドメイン(GoDaddy)からPHPを使用して電子メールを送信

<?php 
    ob_start(); 
    if(isset($_POST['Submit'])) 
    { 
     $your_name=$_POST['your_name']; 
     $your_email=$_POST['your_email']; 
     $your_enquiry=$_POST['your_enquiry']; 
     @mysql_connect("localhost","xxxxx","xxxx"); 
     @mysql_select_db("suryapra_aenugula_karthik"); 
     [email protected]_query("select * from contact_table where your_email='".$your_email."'") or die("selection error"); 
     $numrows=mysql_num_rows($query); 
     if($numrows==0) 
      { 
       $sql="insert into contact_table (your_name, your_email, your_enquiry) values ('$your_name', '$your_email', '$your_enquiry')" or die ("insertion error"); 
       $result=mysql_query($sql); 
       if($result) 
       { 
        $to='$your_email'; 
        $from="[email protected]"; 
        $subject="hello"; 
        $message="email sent succesfully"; 
        mail($to,$from,$subject,$message); 
        header("Location: contact_form1.php"); 
        ob_end_flush(); 
       } 
        else 
        { 
         echo("Enter Correct Details!"); 
        } 
      } 
      else 
       { 
       echo("Already You contacted with that email.Please Check again!!!"); 
       header("Refresh:4; url=contact.php"); 
       ob_end_flush(); 


       } 
    } 
    ?> 

であるこの

$to='$your_email'; 
$from="[email protected]"; (my domain username) 
$subject="hello"; 
$message="email sent succesfully"; 
mail($to,$from,$subject,$message); 

を得ました。 誰か助けてください.....

答えて

1

まずは:mysqlを使用しないでください。これは推奨されていません。 mysqliやPDOの使い方を学んでください。

mail()機能は、SMTPを使用しているローカルホストでは使用できません。

+0

ありがとうございます。メールの送信を簡単に教えてください。 –

+0

http://stackoverflow.com/questions/19132171/send-email-from-localhost-running-xammp-in-php-using-gmail-mail-サーバ –

関連する問題