Hey all!

I am having problems with my form to email script. Ive looked at numerous tutorials and i am prety sure that i am not coding anything wrong.

I am simply using two pages:

contact.php - includes the form which submits to...
sendmail.php - uses the php mail function (mail($to,$subject.....))

could it be possible that the server which i am hosting my site on will not accept posting to an outside email address? i have read this somewhere. is there any way to overcome this?

Thanks in advance.

GavW

    How about posting your PHP script for sending, I can probably help you then. Also, what kind of error are you receiving?

      I am receiving no error. Check out what i am trying to do here:

      http://www.williams-g.co.uk/assessment/contact.php

      As for the code on my sendemail.php page:

      <?php
      $ip = $POST['ip'];
      $httpref = $
      POST['httpref'];
      $httpagent = $POST['httpagent'];
      $visitor = $
      POST['visitor'];
      $visitormail = $POST['visitormail'];
      $notes = $
      POST['notes'];
      $attn = $_POST['attn'];

      if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
      {
      echo "<h2>Use Back - Enter valid e-mail</h2>\n";
      $badinput = "<h2>Feedback was NOT submitted</h2>\n";
      }
      if(empty($visitor) || empty($visitormail) || empty($notes )) {
      echo "<h2>Use Back - fill in all fields</h2>\n";
      }
      echo $badinput;

      $todayis = date("l, F j, Y, g:i a") ;

      $attn = $attn ;
      $subject = $attn;

      $notes = stripcslashes($notes);

      $message = " $todayis [EST] \n
      Attention: $attn \n
      Message: $notes \n
      From: $visitor ($visitormail)\n
      Additional Info : IP = $ip \n
      Browser Info: $httpagent \n
      Referral : $httpref \n
      ";

      $from = "From: $visitormail\r\n";

      mail("gavw316@gmail.com", $subject, $message, $from);

      ?>

      <p align="center">
      Date: <?php echo $todayis ?>
      <br />
      Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
      <br />

      Attention: <?php echo $attn ?>
      <br />
      Message:<br />
      <?php $notesout = str_replace("\r", "<br/>", $notes);
      echo $notesout; ?>
      <br />
      <?php echo $ip ?>

      <br /><br />
      <a href="contact.php"> Next Page </a>
      </p>

        Echo all the variables that you are using in the mail() function so we can make sure they are all correct. Then let me know when its done and I'll take a look.

          Does the script work when you send it to an email address on the same server?

            im not too sure as it is managed by my University so i dont have any admin access to it. I figured this might be the problem.

            Ive tried assigning my variables to the mail function but im getting that error...

              Well try and debug. First step, see if it will send to an email address on the same server. If that works, but it won't send out...there's your problem. I don't see how that would happen...but if you've read it somewhere, you would know better than I.

                only problem with that is that i dont no any email addresses that are on the same server. I wouldnt of thought that this would be a problem either but i cant see much else wrong with my code.

                  Write a Reply...