Jump to content

bmccarthy

New Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by bmccarthy

  1. Hello, Something is wrong with the below php code that allows the form to send to three separate recipients with three separate messages. Something in the below code is causing recipients A's email to come through just fine. The problem is that recipient B receives A's message as well as their message and recipient C to receive A's and B's message as well as their message. (I hope that makes sense!). Note: I have changed some of the text for anonymity purposes. I'm sure I'm missing something simple that closes/ends the first email but I'm not sure what. Please help. Thanks! <?php $to = 'me@domain'; $subject = 'subject line'; $url = 'http://www.domain.com/confirmation.html'; $headers .= "From: info@domain.com\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $message .= '<html><body>'; $message .= "&nbsp"; $message .= "&nbsp"; $message .= "<strong>Referral</strong></br>"; $message .= "The following information has been submitted by " . strip_tags($_POST['submitter']) . " with ID " . strip_tags($_POST['MID']) . " on " . strip_tags($_POST['Today']) . ".</br>"; $message .= "Please reach out to the following referral:</br>"; $message .= "Name: " . strip_tags($_POST['name']) . ".</br>"; $message .= "Contact Phone: " . strip_tags($_POST['phone']) . ".</br>"; $message .= "Email Address: " . strip_tags($_POST['email']) . ".</br>"; $message .= "</br>"; $message .= "</br>"; $message .= "</br>"; $message .= "Thank You!"; mail($to, $subject, $message, $headers); $to = $_POST['semail']; $subject = 'Thank you for your submission!'; $headers .= "From: info@domain.com\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $message .= '<html><body>'; $message .= "&nbsp"; $message .= "&nbsp"; $message .= "Dear " . strip_tags($_POST['submitter']) . ",</br>"; $message .= "Thank you for your submission! </br>"; $message .= "We will reach out to " . strip_tags($_POST['name']) . " per your referral. </br>"; $message .= "</br>"; $message .= "We appreciate your time and thank you for your support!"; $message .= "</br>"; $message .= "Have a great day,"; mail($to, $subject, $message, $headers); $to = $_POST['email']; $subject = "" . strip_tags($_POST['submitter']) . " wanted us to call you!</br>"; $headers .= "From: info@domain.com\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $message .= '<html><body>'; $message .= "&nbsp"; $message .= "&nbsp"; $message .= "Dear " . strip_tags($_POST['name']) . ",</br>"; $message .= "Recently, " . strip_tags($_POST['submitter']) . " provided us with your information because they wanted to let you know about the great experience they have had with our company and how you could benefit from the services they currently use.</br>"; $message .= "We are sending this email to confirm your contact information. One of our expert Account Service representatives will be reaching out to you at " . strip_tags($_POST['phone']) . " shortly to discuss the services we can offer to your company.</br>"; $message .= "</br>"; $message .= "We appreciate your time and look forward to speaking with you!"; $message .= "</br>"; $message .= "Have a great day,"; mail($to, $subject, $message, $headers); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?>
  2. @xyph I apologize if I came across as dismissive. That was not my intention. I am a rookie at php so I don't necessarily know what I'm talking about. Where in the code do I place the error checker? I tried placing it just below the mail command, but that didn't work. Where is the proper placement of it?
  3. @batwimp I replaced copy() with move_uploaded_file(), but still receive the configuration error message. @xyph $userfile is the key/name within the my html form on the webpage. The html code for the form is: <form action="sendresults.php" method="post" enctype="multipart/form-data" name="PCI" target="_parent" id="PCI"> <table width="722" border="0"> <tr> <td width="193"> </td> <td width="161"><div align="left" class="style9">Name</div></td> <td width="199"><span id="sprytextfield5"> <label> <input name="Name" type="text" id="Name" size="45"> </label> <span class="textfieldRequiredMsg"></span></span></td> <td width="151"> </td> </tr> <tr> <td> </td> <td><div align="left" class="style9">Company Name</div></td> <td><span id="sprytextfield4"> <input name="Company" type="text" id="Company" size="45"> <span class="textfieldRequiredMsg"></span></span></td> <td> </td> </tr> <tr> <td> </td> <td><div align="left" class="style9">ID Number</div></td> <td><span id="sprytextfield3"> <input name="MID" type="text" class="style2" id="MID" size="54"> <span class="textfieldRequiredMsg"></span><span class="textfieldInvalidFormatMsg"></span></span></td> <td> </td> </tr> <tr> <td> </td> <td><div align="left" class="style9">Email Address</div></td> <td><span id="sprytextfield2"> <input name="Email" type="text" class="style2" id="Email" size="54"> <span class="textfieldRequiredMsg"></span><span class="textfieldInvalidFormatMsg"></span></span></td> <td> </td> </tr> <tr> <td> </td> <td><div align="left" class="style9">Phone Number</div></td> <td><span id="sprytextfield6"> <input name="Phone" type="text" class="style2" id="Phone" size="54"> <span class="textfieldRequiredMsg"></span><span class="textfieldInvalidFormatMsg"></span></span></td> <td> </td> </tr> <tr> <td colspan="4"><div align="left"> <span id="sprycheckbox2"> <label></label> </span> <table width="100%" border="0" cellpadding="2"> <tr> <td><label for="userfile"> <div align="center">Select a file: </label> <input type="file" name="userfile"> <br /> </div></td> </tr> </table> <br> </div></td> </tr> <tr> <td colspan="4"><div align="left"> <span id="sprycheckbox1"> <label> <span class="style1"> <span class="style2"> <input type="checkbox" name="Certify" id="Certify"> </span></span></label> </span><span class="style9"> I declare that I have read and understand the Security Guidelines and that I comply within these guidelines. I am Compliant</span>.<br> </div></td> </tr> <tr> <td colspan="4"><div align="right"><span class="style12"> <label> *All Fields Are Required <div align="center"> <input type="submit" name="I am Compliant" value="Submit"> </div> </label></td> </tr> </table> </form> Also, where in my .php do I put the error checker? I tried placing it after the mail command, but...?
  4. I can't figure out what the heck is wrong with this code. When I attempt to use it, it get an error message from my browser that the file is under maintenance or configured incorrectly. I am attempting to have a user complete a form field on my website, upload a document, and send the email to me with the file attached. <?php $subject = 'I am from '.$_POST['MID'].' '; $emailadd = 'me@domain.com'; $req = '1'; $text = "I declare that I have read and understand the Guidelines and that I comply within these guidelines. :\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } $file_name = $_FILES['userfile']; $new_file_name = $file_name . trim($_POST['MID']); $path= "Confirmation/" . $new_file_name; if($userfile) { if(copy($_FILES['userfile']['tmp_name'], $path)) { echo "Successful<BR/>"; echo "File Name :" . $new_file_name."<BR/>"; echo "File Size :" . $_FILES['userfile']['size']."<BR/>"; echo "File Type :" . $_FILES['userfile']['type']."<BR/>"; } else { echo "Error, file did not upload correctly!"; } mail($emailadd, $subject, $text, 'From: '.$_POST['Name'].' <'.$_POST['Email'].'>'); header("Location: compliance/confirmation.html"); ?> What am I doing wrong? Thanks!
×
×
  • 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.