Menu

Change Reply-To Email (not server address)

Help
2014-04-17
2014-04-19
  • Mike Snyder

    Mike Snyder - 2014-04-17

    I have a simple form setup with one text area to submit an anonymouse question to our executive director. To make it simple, the old form I was using (Frontpage) used my email as the reply to so all the executive director had to do was hit reply which sent her answer to me for posting on the web.

    As it is now the email comes from userid@servername.com and I am trying to change that.

    This is what I attempted which isn't working, not a big PHP guy so I appreciate your help!

    $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

    session_start();
    if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) {
    mail("email@domain.org","Question to Cathy",$message,"From: email@domain.org","Form data:

    Question: " . $_POST['field_1'] . "

    ");

    include("cathy_thankyou.html");
    }
    else {
    echo "Invalid Captcha String.";
    }

    ?>

     
    • TNTEverett

      TNTEverett - 2014-04-18

      I tried to respond to you a couple of times but the emails got rejected.

      Did you get this?

      -------- Original Message --------
      Subject: [phpformgen:discussion] Re: Form & Code Integration
      Date: Mon, 14 Apr 2014 02:20:50 +0000

      OK lets start with basics of a generated form.
      The form is generated with the following most basic files:
      form.html
      processor.php
      There may also be some of the following (some are version dependent):
      style.css
      monofont.ttf
      CaptchaSecurityImages.php
      imgs/
      files/
      calendar/

      The form function is contained within the first two files but if you
      take all the files from the generated form folder "./forms/form336862/*"
      you should just be able to copy them to your site and point your browser
      to the form.html files and it should work.
      I see you integrated the form into your contact page but what is missing
      is the form action variable is empty. In your generated form.html you
      should have seen something like this:

      Your contact page has this:

      Try changing action="" to action="processor.php" and make sure the
      processor.php file from your generated form is located in the same place
      as the contact page. Another suggestion: Uniformserver is free and runs
      on a Windows PC. It has a real easy web server you can start and stop
      that will allow you to test your pages first before copying them to your
      live site. http://www.uniformserver.com/ There are others. I just happen
      to be partial to this one. The generator should be loaded so you can
      generate forms but NEVER leave it on your live site after you are done.
      In fact if you use Uniformserver you can run the generator locally this
      way you never have the generator on your live site. On 4/13/2014 7:58
      PM, Mike wrote: > > Hi TNT',while I continued my research over the
      weekend, I was able to > advance the 'ball'. I have copied my new form
      to my server > root/phpForms/forms/form336862/*, launched it
      successfully, changed > the permissions on sub folder /forms to 777 but
      receiving 'access > denied' error message after I fill in the data and
      hit the submit > button... > > Any ideas/suggestions? I will also
      continue to research until I hear > from you. > > Thanks > Mike > >


      > > Form & Code Integration > > >

      Sent from sourceforge.net because you indicated interest in >
      https://sourceforge.net/p/phpformgen/discussion/149299/ > > To
      unsubscribe from further messages, please visit >
      https://sourceforge.net/auth/subscriptions/ > --- Form & Code
      Integration

      --- Sent from sourceforge.net because you indicated interest in To
      unsubscribe from further messages, please visit

      On 4/17/2014 12:47 PM, Mike Snyder wrote:

      I have a simple form setup with one text area to submit an anonymouse
      question to our executive director. To make it simple, the old form I
      was using (Frontpage) used my email as the reply to so all the
      executive director had to do was hit reply which sent her answer to me
      for posting on the web.

      As it is now the email comes from userid@servername.com and I am
      trying to change that.

      This is what I attempted which isn't working, not a big PHP guy so I
      appreciate your help!

      $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

      session_start();
      if( ($_SESSION['security_code']==$_POST['security_code']) &&
      (!empty($_POST['security_code'])) ) {
      mail("email@domain.org","Question to Cathy",$message,"From:
      email@domain.org","Form data:

      Question: " . $_POST['field_1'] . "

      ");

      include("cathy_thankyou.html");
      }
      else {
      echo "Invalid Captcha String.";
      }

      ?>


      Change Reply-To Email (not server address)
      https://sourceforge.net/p/phpformgen/discussion/149299/thread/4cc79805/?limit=50#134d


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/phpformgen/discussion/149299/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
    • TNTEverett

      TNTEverett - 2014-04-18

      Follow this example:
      http://php.net/manual/en/function.mail.php

      $to = 'nobody@example.com';
      $subject = 'the subject';
      $message = 'hello';
      $headers = 'From: webmaster@example.com' . "\r\n" .
      'Reply-To: webmaster@example.com' . "\r\n" ;

      mail($to, $subject, $message, $headers);

      On 4/17/2014 12:47 PM, Mike Snyder wrote:

      I have a simple form setup with one text area to submit an anonymouse
      question to our executive director. To make it simple, the old form I
      was using (Frontpage) used my email as the reply to so all the
      executive director had to do was hit reply which sent her answer to me
      for posting on the web.

      As it is now the email comes from userid@servername.com and I am
      trying to change that.

      This is what I attempted which isn't working, not a big PHP guy so I
      appreciate your help!

      $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

      session_start();
      if( ($_SESSION['security_code']==$_POST['security_code']) &&
      (!empty($_POST['security_code'])) ) {
      mail("email@domain.org","Question to Cathy",$message,"From:
      email@domain.org","Form data:

      Question: " . $_POST['field_1'] . "

      ");

      include("cathy_thankyou.html");
      }
      else {
      echo "Invalid Captcha String.";
      }

      ?>


      Change Reply-To Email (not server address)
      https://sourceforge.net/p/phpformgen/discussion/149299/thread/4cc79805/?limit=50#134d


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/phpformgen/discussion/149299/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
  • Mike Snyder

    Mike Snyder - 2014-04-17

    Thanks for the reply, I didn't see these yesterday.

    I see how this would work just not sure how to use it in the PHP code generated. When I added it the form no longer works.

    This line seems to be what needs to be modified or replaced:

    mail("email@domain.org","Question to Cathy",$message,"From:
    email@domain.org","Form data:

    Not sure how to use this code in my new form however:

    $to = 'nobody@example.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" ;
    mail($to, $subject, $message, $headers);

     

    Last edit: Mike Snyder 2014-04-18
  • TNTEverett

    TNTEverett - 2014-04-19

    OK, working through the discussion page instead of email because I kept screwing it up.
    Your form is an html page and your form processor is a php page. This code goes in your processor page and the variables from your form need to be inserted appropriately. If you still don't know, either post your processor here or send me a private message so we can trade external emails so we can pass attachments back and forth.

     

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.