Menu

E-mail not sending

Help
Anonymous
2003-01-16
2003-01-17
  • Anonymous

    Anonymous - 2003-01-16

    I can't find any help on the current postings. The software looks great but I the form does not send the email.

    After uploading to my ISP
    1. It generates the form OK and connects to Mysql no problem. It also goes to the 'thank you" URL. but no email is received.

    2. The mail is generated in the mail() in process.php right? I am using another script which uses the mail function and it generates mail fine (which means that PHP is talking to the mail server at my ISP right?). So any clues how I can debug what is happening?

     
    • Musawir Ali

      Musawir Ali - 2003-01-16

      Paste the contents of process.php file in here so i can take a look.

       
    • Anonymous

      Anonymous - 2003-01-16

      This is the contents of the process.php file in the 'forms' directory:

      Thanks for the help.

      <?php
      $errors=0;
      $error="The following errors occured while processing your form input.<ul>";
      if($errors==1) echo $error;
      else{
      $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$_SERVER['HTTP_HOST'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
      $message="Industry: ".$_POST['Industry']."
      ";
      mail("dhjacobs@ajlink.com.au","Form Submitted at your website",$message,"From: phpFormGenerator");
      $link = mysql_connect(".....my password etc goes here and works fine........");
      mysql_select_db("dhjphpform",$link);
      $query="insert into industry (dhjresp) values ('".$_POST['Industry']."')";
      mysql_query($query);
      $make=fopen("admin/data.dat","a");
      $to_put="";
      $to_put .= $_POST['Industry']."
      ";
      fwrite($make,$to_put);
      header("Refresh: 0;url=http://www.ajlink.com.au");
      }
      ?>

       
    • Musawir Ali

      Musawir Ali - 2003-01-17

      mail function looks perfectly generated. Its definately something wrong with your mail server. You could make sure by running this on some other machine.

       
    • Anonymous

      Anonymous - 2003-01-17

      Thanks.

      1. I have verified that other scripts that I am using which use the mail() work. So I have been trying to compare what is the difference between yours and theirs.

      2. I added 'echo' to see what is happening just before mail() in process.php.

      The result:

      $where_form_is    - this is correct
      $message           - this is correct

      Then I get

      Warning: Cannot add header information - headers already sent by (output started at /www.ajlink.com.au/htdocs/phpform/forms/process.php:12) in /www.ajlink.com.au/htdocs/phpform/forms/process.php on line 23

      Any further thoughts?

       
    • Anonymous

      Anonymous - 2003-01-17

      Aha!

      1. I checked the error files on the ISP server. It showed that the mail() for your program was "not being sent - rejected by all available servers". This must mean the ISP's spam restrictions and I tracked it to the fact that mail() at my ISP needs a legitimate email address in the "From:" field in the following line:

      mail("djacobs@ajlink.com.au","Form Submitted at your website",$message,"From: phpFormGenerator");

      When I changed this 'presto' the email is sent.

      I still don't have a reason why my previous posting 'header already sent error' is generating.

      Hope this helps someone.

       
    • Musawir Ali

      Musawir Ali - 2003-01-17

      yes, some ISPs have quite strict SMTP policies. However, you really don't _need_ to provide an address in the From . Your smtp server (sendmail or whatever your ISP uses), should provide some default server name (i.e. its hostname), and that gets used by PHP as the sender. I did not explicitly add any From email address so that it would look like its coming from any server that the program is installed it.
      About the header error,.. that is pretty natural. When you are echo'ing text, or anything for that matter.. you will _see_ that text.. and therefore, the page can't be just redirected. Once you remove the echos u added, the warning will go away.

       
    • Anonymous

      Anonymous - 2003-01-17

      Many thanks for your help and understand about default server name.

      Yes I worked out about the echo. Need to do more homework!

      It is always gratifying to find a solution!

      I haven't checked yet the proposed future features but apart from the "thank you page" is there an auto responder email or can I just bolt one on?

      It seems that in previous versions reference is made to an 'email field' . Is this dropped from the most recent versions? Did that verify the email address?

      Thanks. 

       
    • Musawir Ali

      Musawir Ali - 2003-01-17

      hmm.. I never did have any _email_ field in any of the versions. But I do have plans for a variety of different field verifications in the next version. These would include:
      Email Address
      Web Address (URL)
      Currency
      British Post Codes
      US Zip Code
      Canadian Zip Code
      Phone Number
      All Numeric Input
      All Alphabet Input
      Alpha-Numeric Input

      Also, the auto responder would be a feature in the next version. I dropped it out uptil now because all forms might not have email address fields. So with the introduction of field verification, I can include the autoresponder with forms that have email address field types.

       
    • Anonymous

      Anonymous - 2003-01-17

      This is the stuff about the 'email code'  from the project homepage. This is what I was referring to:

      New release! - 05.14.2002
      phpFormGenerator v1.01 has been released. The minor change made was to remove the form email field as being required. The user will no longer be required to enter an email address, if none is provided, the form simply avoids generating the code for form mailing. This allows users to create forms that just need to insert data into the database. The email feature however is fully functional, if a valid email address is provided, the for email code will be generate.

       
    • Musawir Ali

      Musawir Ali - 2003-01-17

      well thats a different thing.. tahts for emailing to the admin . Before, we had the email field as required.. now its optional. And yes, that email is verified to be a certain format. otherwise it'll give u an error.

       
    • Anonymous

      Anonymous - 2003-01-17

      Thanks. End.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.