Page 1 of 1

mail($to, $subject, $message, $headers); not working???

Posted: Fri Mar 25, 2011 3:19 am
by helloise
please help, here is all my code:

Code: Select all

<div id='div_phone_big'>
</div>

<head>
<script type="text/JavaScript">
  function getChoice(val)
  {
      yesNo = new Array("Yes", "No");
      var getsel = document.contactus.yesnolist.value;
      var e = document.getElementById("yesnolist");
      var strUser = e.options[e.selectedIndex].value;
      if (strUser == "no")
      {
          //alert('lakjdlakjsdlajd');
           window.location.href = "http://www.rainbowcode.net/index.php/util/faq";
           //document.write(window.location.href);
           window.location('http://www.rainbowcode.net/index.php/util/faq');
      }
      else
      {
          document.contactus.emailreply.value = "";
          document.contactus.commtext.value = "";
          document.contactus.message.value = "";
          document.contactus.commlist.value = "";
      }
      return strUser;
  }
  
  function getCommChoice(x)
  {
      comm = new Array("Compliment","Complaint","Feedback","Suggestion","Billing Query","Other");
      var getsel = document.contactus.commlist.value;
      document.contactus.message.value = comm[getsel];
      return document.contactus.message.value;
  }
  
  function sayThanks()
  {
      alert("Thank you for submitting");
      return true;
  }
</script>
</head>

<body>
<form name = "contactus" method="post" onSubmit="return sayThanks()">

<table class='table_format_content_rbc' border='0'>
<div>
	<span class='spn_big_lightblue_rbc'>RAINBOW</span><span class='spn_big_black_rbc'>CODE:    CONTACT US </span>
    <td colspan='3' align='left' class='small_header_rbc'> 
    <h3>Problems and general queries</h3>
        <li>Phone our call centre on 086 110 6472 ( Available  8am-5pm from monday-friday ) or</li>
        <li>Email us at 
       <a href="mailto:helloise@pagesalive.co.za">feedback@miranetworks.net</a>
       </li>
    </td>   
</div>        

<div>     
<tr></tr>
<tr></tr>  
	<tr>
		<td colspan='3' align='left' class='small_header_rbc'> 
         <h3>Frequently Asked Questions</h3>
		    <li>Please take a moment to read the Frequently Asked Questions as the solution to your query could be waiting for you there!</li>
            <li>Have you read the <?php echo link_to('FAQ','util/faq') ?> ? 
                 <select id="yesnolist" onChange="getChoice(this.value)">
                    <option value="yes" selected="selected">Yes</option>
                    <option value="no">No</option>
                 </select>
            </li>    
    </tr>  
    <tr></tr>  
    <tr></tr>  
</div>

<div>
    <tr>
		<td colspan='3' align='left' class='small_header_rbc'> 
        <h3>Feedback and Suggestions</h3>
                </select>     
           </li> 
           
                 <textarea name="message" rows="10" cols="20"></textarea>
                  <br /><br />
                  <?php
                        $to      = "helloise@pagesalive.co.za";
                        $subject = $_REQUEST["commlist"];
                        $email = $_REQUEST["emailreply"];
                        $message = $_REQUEST["message"];
                        $headers = "From: $email";
                        mail($to, $subject, $message, $headers);
                        ?>
                 <input type="submit" value="Send">
                 <input type="reset" value="Reset">
           

		</td>
	</tr>
</div>    
</table>
	
	
<table class='table_format_content_rbc' border='0'>
	<tr>	
		<td colspan='3' align='left' class='small_header_rbc'> 
			<br/>
		</td>
	<tr>
</table>
</form>
</body>

and also set the php.ini file portion:
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = /usr/sbin/sendmail -t

and also ran:
$ sudo echo "test" | mail -s "test" helloise@pagesalive.co.za
The program 'mail' can be found in the following packages:
 * heirloom-mailx
 * mailutils

please help??                 <option value="feedback">Feedback</option>
                    <option value="suggestion">Suggestion</option>
                    <option value="billquery">Billing Query</option>
                    <option value="other">Other</option>
                </select>     
           </li> 
           
                 <textarea name="message" rows="10" cols="20"></textarea>
                  <br /><br />
                  <?php
                        $to      = "helloise@pagesalive.co.za";
                        $subject = $_REQUEST["commlist"];
                        $email = $_REQUEST["emailreply"];
                        $message = $_REQUEST["message"];
                        $headers = "From: $email";
                        mail($to, $subject, $message, $headers);
                        ?>
                 <input type="submit" value="Send">
                 <input type="reset" value="Reset">
           

		</td>
	</tr>
</div>    
</table>
	
	
<table class='table_format_content_rbc' border='0'>
	<tr>	
		<td colspan='3' align='left' class='small_header_rbc'> 
			<br/>
		</td>
	<tr>
</table>
</form>
</body>

and also set the php.ini file portion:
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = /usr/sbin/sendmail -t

and also ran:
$ sudo echo "test" | mail -s "test" helloise@pagesalive.co.za
The program 'mail' can be found in the following packages:
 * heirloom-mailx
 * mailutils

please help??

Re: mail($to, $subject, $message, $headers); not working???

Posted: Fri Mar 25, 2011 10:47 am
by social_experiment
Any error messages?

Re: mail($to, $subject, $message, $headers); not working???

Posted: Fri Mar 25, 2011 9:25 pm
by fugix
you have your SMTP server setup?

Re: mail($to, $subject, $message, $headers); not working???

Posted: Mon Mar 28, 2011 2:49 am
by helloise
social_experiment wrote:Any error messages?
nope..no error messages
all i can say is i run the following:
ubuntu 10.04
php: 5.3.2
symfony 1.4.2
apache2
and gmail
os: 'Linux helloise 2.6.32-27-generic #49-Ubuntu SMP Wed Dec 1 23:52:12 UTC 2010 i686'
i dont get any error messages the mail just does not come through on my gmail

i also ran the following and got:
helloises@helloise:~/traffic_2/phoenix$ ls -l /usr/sbin/sendmail
lrwxrwxrwx 1 root root 5 2011-03-25 13:52 /usr/sbin/sendmail -> exim4
helloises@helloise:~/traffic_2/phoenix$ which mail
/usr/bin/mail
helloises@helloise:~/traffic_2/phoenix$ whereis mail
mail: /usr/bin/mail /usr/share/man/man1/mail.1.gz

so i am not sure why my mail is not coming through
please help?
thank you

Re: mail($to, $subject, $message, $headers); not working???

Posted: Mon Mar 28, 2011 10:22 am
by social_experiment
What results do you get when running the code below, place on it's own page :

Code: Select all

<?php
 $to = "helloise@pagesalive.co.za";
 $subject = 'Test subject';
 $email = 'other@mail.addy';
 $message = 'Test message';
 $headers = "From: $email";
 $mail = mail($to, $subject, $message, $headers);

 if ($mail) {
  echo 'Sent';
 }
 else {
  echo 'Not sent';
 }
?>

Re: mail($to, $subject, $message, $headers); not working???

Posted: Tue Mar 29, 2011 2:02 am
by helloise
thanks i deployed to the live box and all works now..something is not set up on my devbox :) as long is it works on the live system
thanks for all the help :)