hey
i posted earlyer today with a poll problem and you guys did an awsum job helping me out, so here i go again. 🙂

I have a contact form on my site, which when the user fills out all the forms it takes them to the thank you page, and if they dont fill it out proprely it tells them, so this is all fine except i dont recive any emails, lol could this be becasue i cant do it from my own computer?

[URL]http://b_ball_player9.cjb.cc/contact.html[/URL]

any info would be greatly appriected

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
 <html lang="en">
<head>
  <title>Milo's Portfolio</title>
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Revisit-After" content="5 Days">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">

  <link href="file.css" rel="stylesheet" type="text/css">

   <link rel="shortcut icon" href="favicon.ico" >

<link rel="alternate stylesheet" type="text/css" href="file.css" title="swap1" >
<link rel="alternate stylesheet" type="text/css" href="file2.css" title="swap2" >
<script type="text/javascript" src="styleswitcher.js"></script>
</head>




<body>
<div id="container_blue">


 <div id="brown_button">
   <a href="index.html"><img src="images/home_button.gif" alt="Home" border="0" /></a></div>


<div id="red_button">
  <a href="portfolio.html"><img src="images/port_button.gif" alt="Portfolio" border="0" /></a></div>


 <div id="blue_button">
   <a href="contact.html"><img src="images/contact_button.gif" alt="Home" border="0" /></a></div>


<div id="green_button">
  <a href="about.html"><img src="images/about_button.gif" alt="Portfolio" border="0" /></a></div>




<div id="contact_form">
<form method="post" action="send.php">
    Name:<br><input name="name" type="text" size="30"><br><br>
    Email:<br><input name="email" type="text" size="30"><br><br>
    Comments:<br><input name="subject" type="text" size="30"><br><br>
    Message:<br><textarea name="msg" cols="25" rows="6"></textarea><br><br>
    <input type="reset" value="Reset"> <input type="submit" value="Send">
   </form>

</div>










<div id="valid">
<a href="http://validator.w3.org/check?uri=referer"><img
        src="http://www.w3.org/Icons/valid-html401"
        alt="Valid HTML 4.01 Transitional" height="31" width="88" border="0" ></a>

<img src="images/validcss.gif" alt="Valid CSS" /></div>


</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
       "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
  <head>
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Revisit-After" content="5 Days">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>Thank you for contacting us</title>

   <link href="file.css" rel="stylesheet" type="text/css">

   <link rel="shortcut icon" href="favicon.ico" >

<link rel="alternate stylesheet" type="text/css" href="file.css" title="swap1" >
<link rel="alternate stylesheet" type="text/css" href="file2.css" title="swap2" >
<script type="text/javascript" src="styleswitcher.js"></script>


  </head>
  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" alink="#0000FF" vlink="#0000FF">
   <h1>Thank you for contacting us</h1>

   <!-- your html -->

   <div id="container_blue">


 <div id="brown_button">
   <a href="index.html"><img src="images/home_button.gif" alt="Home" border="0" /></a></div>


<div id="red_button">
  <a href="portfolio.html"><img src="images/port_button.gif" alt="Portfolio" border="0" /></a></div>


 <div id="blue_button">
   <a href="contact.html"><img src="images/contact_button.gif" alt="Home" border="0" /></a></div>


<div id="green_button">
  <a href="about.html"><img src="images/about_button.gif" alt="Portfolio" border="0" /></a></div>



<?php
$to       = "b_ball_player9@hotmail.com"; // change to your email address
$name     = $_POST['name'];
$email    = $_POST['email'];
$subject  = $_POST['subject'];
$msg      = $_POST['msg'];
$d        = date('l dS \of F Y h:i:s A');
$sub      = "form to mail";
$headers  = "From: $name <$email>\n";  
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; $mes = "Subject: ".$subject."\n"; $mes .= "Message: ".$msg."\n"; $mes .= "Name: ".$name."\n"; $mes .= 'Email: '.$email."\n"; $mes .= 'Date & Time: '.$d; if (empty($name) || empty($email) || empty($subject) || empty($msg)) { echo " <h3>Sorry all fields are required.</h3>"; } elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { print " <h3>Sorry the email address you entered looks like it's invalid.</h3>"; } else { mail($to, $sub, $mes, $headers); print " <h3><center>Thank you ".$name." for contacting us.<br>We will get back to you as soon as posiable</center></h3>"; } ?> <div id="valid"> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88" border="0" ></a> <img src="images/validcss.gif" alt="Valid CSS" /></div> </div> </body> </html>

    Hi,

    I had some problems with sending mail with PHP a while ago, mine was with sending Japanese characters in the subject line but it sends plain text fine as well 😉

    Paste this function after your <?php and before you define the $to variable:

    function jisMail($mes, $sub, $to, $from, $rto, $plain){
       //JIS Email function by Shadar
       //www.shadar.co.uk
       //Come by for more useful code snippets
    
       //Set up header
       $header =  "MIME-Version: 1.0\r\n";
       $header = $header . "From: ".$from."\r\n"; ;
       $header = $header . "Reply-To: ".$rto." \r\n"; ;
       if($plain){
          $header = $header .
             "Content-type: text/plain; charset=JIS\r\n";
       }else{
          $header = $header .
             "Content-type: text/html; charset=JIS\r\n";
       }
       $header = $header . "Content-Transfer-Encoding:7bit\r\n";
    
       //Set the internal language for the multi-byte functions
       mb_language("ja");
       $message = mb_convert_encoding($mes, "JIS", "AUTO");
       $subject = mb_convert_encoding($sub, "JIS","AUTO");
       $subject = mb_encode_mimeheader($subject);
    
       mail($to, $subject, $message, $header);
    }
    

    Then change your mail function call to read:

    jisMail($mes, $sub, $to, $email, $email, true); 
    

    and that should be it, I even tested it and it works with me.

    Shadar.

      oh cool thanks alot

      quick question, i got that 1st part, but where do i paste the second part?

      sorry, php is something thats still very new to me

        yea i found where to paste it, but now when i click submit, i get this error

        Fatal error: Call to undefined function: mb_language() in /home/cjbcc/public_html/members/b_ball_player9/send.php on line 66

        and this is my php now.

        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
               "http://www.w3.org/TR/html4/loose.dtd">
        <html lang="en">
          <head>
            <meta http-equiv="Pragma" content="no-cache">
            <meta http-equiv="Revisit-After" content="5 Days">
            <meta http-equiv="content-type" content="text/html; charset=utf-8">
            <title>Thank you for contacting us</title>
        
           <link href="file.css" rel="stylesheet" type="text/css">
        
           <link rel="shortcut icon" href="favicon.ico" >
        
        <link rel="alternate stylesheet" type="text/css" href="file.css" title="swap1" >
        <link rel="alternate stylesheet" type="text/css" href="file2.css" title="swap2" >
        <script type="text/javascript" src="styleswitcher.js"></script>
        
        
          </head>
          <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" alink="#0000FF" vlink="#0000FF">
           <h1>Thank you for contacting us</h1>
        
           <!-- your html -->
        
           <div id="container_blue">
        
        
         <div id="brown_button">
           <a href="index.html"><img src="images/home_button.gif" alt="Home" border="0" /></a></div>
        
        
        <div id="red_button">
          <a href="portfolio.html"><img src="images/port_button.gif" alt="Portfolio" border="0" /></a></div>
        
        
         <div id="blue_button">
           <a href="contact.html"><img src="images/contact_button.gif" alt="Home" border="0" /></a></div>
        
        
        <div id="green_button">
          <a href="about.html"><img src="images/about_button.gif" alt="Portfolio" border="0" /></a></div>
        
        
        
        <?php
        
        function jisMail($mes, $sub, $to, $from, $rto, $plain){ 
           //JIS Email function by Shadar 
           //www.shadar.co.uk 
           //Come by for more useful code snippets 
        
           //Set up header 
           $header =  "MIME-Version: 1.0\r\n"; 
           $header = $header . "From: ".$from."\r\n"; ; 
           $header = $header . "Reply-To: ".$rto." \r\n"; ; 
           if($plain){ 
              $header = $header . 
                 "Content-type: text/plain; charset=JIS\r\n"; 
           }else{ 
              $header = $header . 
                 "Content-type: text/html; charset=JIS\r\n"; 
           } 
           $header = $header . "Content-Transfer-Encoding:7bit\r\n"; 
        
           //Set the internal language for the multi-byte functions 
           mb_language("ja"); 
           $message = mb_convert_encoding($mes, "JIS", "AUTO"); 
           $subject = mb_convert_encoding($sub, "JIS","AUTO"); 
           $subject = mb_encode_mimeheader($subject); 
        
           mail($to, $subject, $message, $header); 
        } 
        
        
        
        $to       = "b_ball_player9@hotmail.com"; // change to your email address
        $name     = $_POST['name'];
        $email    = $_POST['email'];
        $subject  = $_POST['subject'];
        $msg      = $_POST['msg'];
        $d        = date('l dS \of F Y h:i:s A');
        $sub      = "form to mail";
        $headers  = "From: $name <$email>\n";  
        $headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; $mes = "Subject: ".$subject."\n"; $mes .= "Message: ".$msg."\n"; $mes .= "Name: ".$name."\n"; $mes .= 'Email: '.$email."\n"; $mes .= 'Date & Time: '.$d; if (empty($name) || empty($email) || empty($subject) || empty($msg)) { echo " <h3>Sorry all fields are required.</h3>"; } elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { print " <h3>Sorry the email address you entered looks like it's invalid.</h3>"; } else { jisMail($mes, $sub, $to, $email, $email, true); print " <h3><center>Thank you ".$name." for contacting us.<br>We will get back to you as soon as posiable</center></h3>"; } ?> <div id="valid"> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88" border="0" ></a> <img src="images/validcss.gif" alt="Valid CSS" /></div> </div> </body> </html>

        any ideas?

          You have to have special extensions to work with multibyte encodings like JIS (japanese encoding) and since I'm guessing that you don't have it and you don't need it - try deleting these lines:

          mb_language("ja");
          $message = mb_convert_encoding($mes, "JIS", "AUTO");
          $subject = mb_convert_encoding($sub, "JIS","AUTO");
          $subject = mb_encode_mimeheader($subject); 
          

          Because they convert text to multibyte encoding needed for japanese...

            thanks man,

            the errors gone now, but still i recive no email,

            could this be my computer?

            what sort of permisions do i have to set for the page?

              Also remember to check your spam in Hotmail, if you are testing a lot you will be sending a pile of identical emails quickly. The spam-daemon might not like that, especially as they are coming from your server but the from and reply-to addys point to somewhere else...

              @: Thanks, copy and paste of old code is easy but I should take the time to make it fit the problem. :bemused:

                You need to have one in order for you to be able to send email through mail() function...

                  i am not sure if i have a sendmail program,

                  can i downlaod this from somewhere?

                  yea i chekd with gmail and hotmail both with spam filters off

                    the [man]mail[/man] function has been in php since PHP3... you shouldnt need to download anything. what version of php are you running and what OS you running it on?

                    also you wana check your php.ini to see if you mail function is setup correctly.. (you never now...)

                      oh ok, im running windows XP home, im not sure which php, how do i check

                      thanks

                        make a php script with this in it and run it...

                        <?

                        phpinfo();

                        ?>

                          oh cool, ok this is what i got

                          PHP Version 4.2.3

                          System Windows NT 5.1 build 2600
                          Build Date Oct 5 2002 15:06:37
                          Server API Apache
                          Virtual Directory Support enabled
                          Configuration File (php.ini) Path C:\WINDOWS\php.ini
                          Debug Build no
                          Thread Safety enabled

                            Write a Reply...