Jump to content

Email doesn't work


HanneSThEGreaT

Recommended Posts

Hi guys, me again.

 

I have been using mail to send emails ( With your great help ) successfully in about three websites. For some reason, my email doesn't want to work with the site I am busy with now. This is my code :

 

<html>
      <head>
            <title>Practice</title>
      </head>
      <body>
<table border="1">
       <tr>
           <td>
<?php
      $emailto="hannes@ncc-cla.com";
      $emailsubject="confirmation";
      $emailfrom="footloose.sa@gmail.com;

                  if(!empty($_POST['uname'])){
                  $yourname=$_POST['uname'];
                  $yoursurname=$_POST['usurname'];
                  echo "hello
            </td>
            <td>"
                ." " . "$yourname" . " " . "$yoursurname
            </td>
         </tr>";

         $emailbody="hello
            </td>
            <td>"
                ." " . "$yourname" . " " . "$yoursurname
            </td>
         </tr>";
}
else{
   echo"<tr>
            <td>
                enter your name
            </td>
        </tr>";

        $emailbody .="<tr>
            <td>
                enter your name
            </td>
        </tr>";
}
   if(isset($_POST['gender'])){      /*isset is what it is set to can be used */
   $gender=$_POST['gender'];
   echo "<tr>
             <td>
                 You are a
             </td>
             <td>
                 " . " " . "$gender
             </td>
   </tr>";
          $emailbody .="<tr>
             <td>
                 You are a
             </td>
             <td>
                 " . " " . "$gender
             </td>
   </tr>";
}
       else{
             echo "<tr>
                       <td>
                           Select Gender
                       </td>
                    </tr>";
             $emailbody .="<tr>
                       <td>
                           Select Gender
                       </td>
                    </tr>";
       }
if(isset($_POST['plang'])){
   $plang=$_POST['plang'];
   echo "<tr>
             <td>
                 You are interested in
             </td>
             <td>
                 " . " " . "$plang
             </td>
         </tr>";
         $emailbody .="<tr>
             <td>
                 You are interested in
             </td>
             <td>
                 " . " " . "$plang
             </td>
         </tr>";
}
   else{
     echo "<tr>
               <td>
                   Select Programming language
               </td>
           </tr>";
           $emailbody .="<tr>
               <td>
                   Select Programming language
               </td>
           </tr>";
   }
print "<tr>
            <td>
                Your qualification is
            </td>
            <td>";
            $emailbody .= "<tr>
            <td>
                Your qualification is
            </td>
            <td>";
foreach ($_POST['qlevel'] as $level){
print "$level<BR>";
$emailbody .="$level<BR>";
}
$headers='From:'. $emailfrom;
                
                 mail($emailto,$emailsubject,$emailbody,$headers);
?>
             </td>
         </tr>
</table>
</body>
</html>

Link to comment
Share on other sites

OK, I managed to get this sorted out. Still a mystery as to why it didn't work the first time. This is my code :

 

<html>
      <head>
            <title>Practice</title>
      </head>
      <body>
<table border="1">
       <tr>
           <td>
<?php
error_reporting(E_ALL | E_STRICT);
  ini_set("display_errors", 1);

                  if(!empty($_POST['uname'])){
                  $yourname=$_POST['uname'];
                  $yoursurname=$_POST['usurname'];
                  echo 'hello
            </td>
            <td>'
                .' ' . $yourname . ' ' . $yoursurname
            . '</td>
         </tr>';

         
}
else{
   echo '<tr>
            <td>
                enter your name
            </td>
        </tr>';


}
   if(isset($_POST['gender'])){      /*isset is what it is set to can be used */
   $gender=$_POST['gender'];
   echo '<tr>
             <td>
                 You are a
             </td>
             <td>
                 ' . ' ' . $gender
            . ' </td>
   </tr>';
         
}
       else{
             echo '<tr>
                       <td>
                           Select Gender
                       </td>
                    </tr>';
           
       }
if(isset($_POST['plang'])){
   $plang=$_POST['plang'];
   echo '<tr>
             <td>
                 You are interested in
             </td>
             <td>
                 ' . ' ' . $plang
            . ' </td>
         </tr>';
        
}
   else{
     echo '<tr>
               <td>
                   Select Programming language
               </td>
           </tr>';
           
   }
print '<tr>
            <td>
                Your qualification is
            </td>
            <td>';
           
foreach ($_POST['qlevel'] as $level){
print $level . '<BR>';

}


// multiple recipients
$to  = 'hannes@ncc-cla.com' . ', '; // note the comma
$to .= 'footloose.sa@gmail.com';

// subject
$subject = 'confirmation';

// message
$message = '
<html>
<head>
  <title>Confirmation</title>
</head>
<body>
  <p>Hello ' . $yourname . ' ' . $yoursurname . '</p>
  <table>
    <tr>
      <th>Gender</th><th>Interests</th><th>Qualification(s)</th>
    </tr>
    <tr>
      <td>' . $gender . '</td><td>' . $plang . '</td><td>';
       foreach($_POST['qlevel'] as $level){
$message .= $level . '<BR>';
}

$message.= '</td>
    </tr>
   </table>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Hannes <hannes@ncc-cla.com>, Dirk <footloose.sa@gmail.com>' . "\r\n";
$headers .= 'From: TESTING123 <testing123@testing123.com>' . "\r\n";
$headers .= 'Cc: hannesthegreat@gmail.com' . "\r\n";


// Mail it
mail($to, $subject, $message, $headers); 
?>
             </td>
         </tr>
</table>
</body>
</html>

 

Thanks anyways for reading!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.