Jump to content

Recommended Posts

Hi,

This is what I've got----

    $Name = "name"; //senders name

$email = "name@name.com"; //senders e-mail adress

$recipient = $_REQUEST['email']; //recipient

$reply = "Congratulations! Video access for " .$_POST['fname']." ".$_POST['lname']."";

 

$mail_body = "content"";

 

All of it is working EXCEPT the reply part. It should be pulling fname and lname rom input fields.

Does anyone know what to do?

Link to comment
https://forums.phpfreaks.com/topic/136285-reply-not-working-need-help/
Share on other sites

        Is this what you need?

 

 

  <?php

 

 

function spamcheck($field)

 

 

  {

  //filter_var() sanitizes the e-mail

  //address using FILTER_SANITIZE_EMAIL

  $field=filter_var($field, FILTER_SANITIZE_EMAIL);

 

  //filter_var() validates the e-mail

  //address using FILTER_VALIDATE_EMAIL

  if(filter_var($field, FILTER_VALIDATE_EMAIL))

    {

    return TRUE;

    }

  else

    {

    return FALSE;

    }

  }

if (isset($_REQUEST['email']))

  {//if "email" is filled out, proceed

  //check if the email address is invalid

  $mailcheck = spamcheck($_REQUEST['email']);

  if ($mailcheck==FALSE)

    {

    echo "Invalid input";

    }

  else

    {//send email

 

   

    $Name = "name"; //senders name

$email = "name@name.com"; //senders e-mail adress

$recipient = $_REQUEST['email']; //recipient

$reply = "Congratulations! Video access for " .$_POST['fname']." ".$_POST['lname']."";

 

$mail_body = "content

"; //mail body

$subject = "Video Access"; //subject

$headers = "From: ". $Name . " <" . $email . ">\r\nbcc: susiem@multiprobe.com\r\n"; //optional headerfields

$headers .= "BCC: name2@name2.com\r\n";

 

mail($recipient, $subject, $mail_body, $reply, $headers); //mail command :)

 

    echo "<font size='3'><font color='#c61317'><strong>Thank you.</font></strong> Please check your email for the access link.</font>";

    }

  }

else

  {//if "email" is not filled out, display the form

  echo "<form method='post' action='videoAccess.php'>

    First Name: <input name='fname' type='text' /><br />

  Last Name: <input name='lname' type='text' /><br />

  Email: <input name='email' type='text' /><br /><br />

  Subject: <strong>Subject</strong><br /><br />

 

 

 

  <input type='submit' />

  </form>";

  }

?>

He meant this!

 

[ code] (no spaces)

         
       
function spamcheck($field)


  {
  //filter_var() sanitizes the e-mail
  //address using FILTER_SANITIZE_EMAIL
  $field=filter_var($field, FILTER_SANITIZE_EMAIL);

  //filter_var() validates the e-mail
  //address using FILTER_VALIDATE_EMAIL
  if(filter_var($field, FILTER_VALIDATE_EMAIL))
    {
    return TRUE;
    }
  else
    {
    return FALSE;
    }
  }
if (isset($_REQUEST['email']))
  {//if "email" is filled out, proceed
  //check if the email address is invalid
  $mailcheck = spamcheck($_REQUEST['email']);
  if ($mailcheck==FALSE)
    {
    echo "Invalid input";
    }
  else
    {//send email
   
   
    $Name = "name"; //senders name
   $email = "name@name.com"; //senders e-mail adress
   $recipient = $_REQUEST['email']; //recipient
   $reply = "Congratulations! Video access for " .$_POST['fname']." ".$_POST['lname']."";
   
   $mail_body = "content
"; //mail body
   $subject = "Video Access"; //subject
   $headers = "From: ". $Name . " \r\nbcc: susiem@multiprobe.com\r\n"; //optional headerfields
   $headers .= "BCC: name2@name2.com\r\n";

   mail($recipient, $subject, $mail_body, $reply, $headers); //mail command 

       echo "Thank you. Please check your email for the access link.";
    }
  }
else
  {//if "email" is not filled out, display the form
  echo "</pre>
<form method="'post'" action="'videoAccess.php'">
    First Name: 

  Last Name: 

  Email: 


  Subject: Subject





  
  </form>";<br>  }<br

[ /code] (no spaces)

 

Look at all the pretty colors...

What this code does is send an automatic email to the email that is indicated in the form field.

I also included fname and lname fields that are being pulled to personalize the email.

 

So, without divulging entire contents of email, the recipient gets and email that offers a link to a video archive, and BCC's me at the same time. That way, I can see who is accessing the archive. In order to also get their names, I would like the emails to begin with "Dear ," or something to that affect.

 

Does this help?

Is this better?

 

nospaces
<?php
       
       
function spamcheck($field)


  {
  //filter_var() sanitizes the e-mail
  //address using FILTER_SANITIZE_EMAIL
  $field=filter_var($field, FILTER_SANITIZE_EMAIL);

  //filter_var() validates the e-mail
  //address using FILTER_VALIDATE_EMAIL
  if(filter_var($field, FILTER_VALIDATE_EMAIL))
    {
    return TRUE;
    }
  else
    {
    return FALSE;
    }
  }
if (isset($_REQUEST['email']))
  {//if "email" is filled out, proceed
  //check if the email address is invalid
  $mailcheck = spamcheck($_REQUEST['email']);
  if ($mailcheck==FALSE)
    {
    echo "Invalid input";
    }
  else
    {//send email
   
   
    $Name = "name"; //senders name
   $email = "name@name.com"; //senders e-mail adress
   $recipient = $_REQUEST['email']; //recipient
   $reply = "Congratulations! Video access for " .$_POST['fname']." ".$_POST['lname']."";
   
   $mail_body = "content
"; //mail body
   $subject = "Video Access"; //subject
   $headers = "From: ". $Name . " <" . $email . ">\r\nbcc: susiem@multiprobe.com\r\n"; //optional headerfields
   $headers .= "BCC: name2@name2.com\r\n";

   mail($recipient, $subject, $mail_body, $reply, $headers); //mail command 

       echo "<font size='3'><font color='#c61317'><strong>Thank you.</font></strong> Please check your email for the access link.</font>";
    }
  }
else
  {//if "email" is not filled out, display the form
  echo "<form method='post' action='videoAccess.php'>
    First Name: <input name='fname' type='text' /><br />
  Last Name: <input name='lname' type='text' /><br />
  Email: <input name='email' type='text' /><br /><br />
  Subject: <strong>Subject</strong><br /><br />



  <input type='submit' />
  </form>";
  }
?>
[/code}no spaces

1) Why do you use REQUEST for some fields and POST for others?  You should stay consistent.

2) Echo out your POSTS (fname, lname);

3) Add this at the top of your script, right after the first <?php tag

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

 

 

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

 

This code makes your page display all errors that go on in your website

 

just use copy and paste this

 

<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);   
       
function spamcheck($field)


  {
  //filter_var() sanitizes the e-mail
  //address using FILTER_SANITIZE_EMAIL
  $field=filter_var($field, FILTER_SANITIZE_EMAIL);

  //filter_var() validates the e-mail
  //address using FILTER_VALIDATE_EMAIL
  if(filter_var($field, FILTER_VALIDATE_EMAIL))
    {
    return TRUE;
    }
  else
    {
    return FALSE;
    }
  }
if (isset($_REQUEST['email']))
  {//if "email" is filled out, proceed
  //check if the email address is invalid
  $mailcheck = spamcheck($_REQUEST['email']);
  if ($mailcheck==FALSE)
    {
    echo "Invalid input";
    }
  else
    {//send email
   
   
    $Name = "name"; //senders name
   $email = "name@name.com"; //senders e-mail adress
   $recipient = $_REQUEST['email']; //recipient
   $reply = "Congratulations! Video access for " .$_POST['fname']." ".$_POST['lname']."";
   
   $mail_body = "content
"; //mail body
   $subject = "Video Access"; //subject
   $headers = "From: ". $Name . " <" . $email . ">\r\nbcc: susiem@multiprobe.com\r\n"; //optional headerfields
   $headers .= "BCC: name2@name2.com\r\n";

   mail($recipient, $subject, $mail_body, $reply, $headers); //mail command 

       echo "<font size='3'><font color='#c61317'><strong>Thank you.</font></strong> Please check your email for the access link.</font>";
    }
  }
else
  {//if "email" is not filled out, display the form
  echo "<form method='post' action='videoAccess.php'>
    First Name: <input name='fname' type='text' /><br />
  Last Name: <input name='lname' type='text' /><br />
  Email: <input name='email' type='text' /><br /><br />
  Subject: <strong>Subject</strong><br /><br />



  <input type='submit' />
  </form>";
  }
?>

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.