.php mailer HELP!?

I was wondering if someone with a little more experience could take a moment to look this over for me. I created a html form that corresponds with the .php file below and for the most part it works perfectly. The only flow is that it sends me one email with all of the info from the form and then also another blank duplicate email. Any idea what's causing this? Could it be from my server?
<?php
/* Subject and Email Variables */
$emailSubject = 'Website Reservation Request';
$webMaster = '[email protected]';
/* Gathering Data Variables */
$name = $_POST['name'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$besttime = $_POST['besttime'];
$address = $_POST['address'];
$sitetype = $_POST['sitetype'];
$rentaltype = $_POST['rentaltype'];
$startmonth =$_POST['startmonth'];
$startday =$_POST['startday'];
$endmonth =$_POST['endmonth'];
$endday =$_POST['endday'];
$pet = $_POST['pet'];
$description = $_POST['description'];
$comments = $_POST['comments'];
$adults = $_POST['adults'];
$children = $_POST['children'];
$locater = $_POST['locater'];
$body = <<<EOD
<br><br><strong>
Name: </strong>$name <br><br>
<strong>Email: </strong>$email <br><br>
<strong>Telephone: </strong>$telephone <br><br>
<strong>Best time to contact: </strong>$besttime <br>
<br>
<strong>Address: </strong>$address <br>
<br>
<strong>Site Type: </strong>$sitetype <br><br>
<strong>Rental Type: </strong>$rentaltype <br>
<br><strong>Number of Guests: </strong>$adults Adults, $children Children <br>
<strong><br><strong>Number of Pets: </strong>$pet <br>
Dates: </strong>$startmonth $startday to $endmonth $endday <br>
<br>
<strong>Equipment Description: </strong>$description <br>
<br><strong>How did you hear about us: </strong>$locater <br>
<br>
<strong>Additional Comments: </strong>$comments <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/* Results rendered as HTML */
$theResults = <<<EOD
EOD;
echo "$theResults";
?>

Impossible to say based on what has been posted here. If you look at the following section of code, it looks as though the forum software has swallowed part of your code:
/* Results rendered as HTML */
$theResults = <<<EOD
EOD;
echo "$theResults";
See the following post for instructions on how to post code: http://forums.adobe.com/thread/427712.
However, from what's visible so far, there should be no reason for a second email.

Similar Messages

  • Need help with PHP mail script [was: Can someone please help me?]

    I'm trying to collect data from a form and email it.  I'm using form2mail.php and the problem is that the email is not collecting the form info and it has the same email address in the From: and To: lines. I'm really stuck and would appreciate any help.
    Here is the HTML code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Contact Us</title>
    <style type="text/css">
    <!--
    .style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
    .style2 {
    font-size: 14px;
    color: #000000;
    body {
    background-color: #FFFFFF;
    body,td,th {
    color: #CC3300;
    .style3 {font-size: 14px; font-weight: bold; }
    .style6 {font-size: 18px}
    .style7 {font-size: 16px}
    .style8 {font-size: 16px; font-family: Verdana, Arial, Helvetica, sans-serif; }
    .style9 {font-size: 16px; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; }
    .style10 {color: #000000}
    -->
    </style>
    </head>
    <body>
    <div align="center"><img src="nav2.jpg" alt="nav bar" width="698" height="91" border="0" usemap="#Map2" />
      <map name="Map2" id="Map2">
      <area shape="rect" coords="560,9,684,38" href="accessories.html" />
    <area shape="rect" coords="456,8,548,38" href="contact.html" />
    <area shape="rect" coords="305,8,435,40" href="photog.html" />
    <area shape="rect" coords="187,9,283,39" href="services.html" />
    <area shape="rect" coords="81,10,167,39" href="aboutus.html" />
    <area shape="rect" coords="5,10,68,39" href="index.html" />
    </map>
      <map name="Map" id="Map">
        <area shape="rect" coords="9,9,69,39" href="index.html" />
        <area shape="rect" coords="83,11,165,39" href="aboutus.html" />
        <area shape="rect" coords="182,9,285,38" href="services.html" />
        <area shape="rect" coords="436,14,560,37" href="contact.html" />
        <area shape="rect" coords="563,14,682,38" href="accessories.html" />
      </map>
    </div>
    <p> </p>
    <form id="TheForm" name="TheForm" action="form2mail.php" method="post">
      <p align="center" class="style2">P<span class="style1">lease fill out form below for a &quot;free no obligation quote&quot; then click submit.</span></p>
      <p align="center" class="style3">(*Required Information)</p>
      <div align="center">
        <pre><strong><span class="style8">*Contact Name</span> </strong><input name="name" type="text" id="name" />
    <span class="style8"><strong>
    Business Name </strong></span><input name="bn" type="text" id="bn" />
    <span class="style8"><strong>*Phone Number <input type="text" name="first" size="3" onFocus="this.value='';"
        onKeyup="checkNumber(this.value); autoTab(this, document.TheForm.second);" maxlength="3" value="###" /> - <input type="text" name="second" size="3" onFocus="this.value='';" onKeyup="checkNumber(this.value); autoTab(this, document.TheForm.third);" maxlength="3" value="###" /> - <input type="text" name="third" size="4" onFocus="this.value='';" onKeyup="checkNumber(this.value); autoTab(this, document.TheForm.fourth);" maxlength="4" value="####"/> </strong></span>
    <strong><span class="style1">*</span><span class="style8">Email Address</span> <input name="email" type="text" id="email" />     </strong> </pre>
        <label><span class="style9">*Re-enter to confirm</span>
        <input name="emx" type="text" id="emx" /></label><br /><br /><span class="style9">
    <label></label>
        </span>
        <p><span class="style9">*Best time to call </span>
          <select name="name1[]" multiple size="1" >
            <option>8am-9am</option>
            <option>9am-10am</option>
            <option>10am-11am</option>
            <option>11am-12pm</option>
            <option>12pm-1pm</option>
            <option>1pm-2pm</option>
            <option>2pm-3pm</option>
            <option>3pm-4pm</option>
            <option>4pm-5pm</option>
            <option>5pm-6pm</option>
            <option>6pm-7pm</option>
            <option>7pm-8pm</option>
          </select>
          <br />
          <br />
          <span class="style9">Type of Location</span>
          <select name="name2[]" multiple size="1" >
            <option>Residential</option>
            <option>Commercial</option>
          </select>
          <br />
          <br />
            <span class="style1"><br />
            <strong><br />
              <span class="style6">*Type of Services Requested:</span></strong><br />
            </span><strong><span class="style10">(check all that apply)</span><br />
                </strong><br />
                <span class="style7"><span class="style1"><strong>Janitorial cleaning</strong></span>
                <input type="checkbox" name="checkbox[]" value="checkbox" multiple/>
                <br />
                </span><strong><br />
                  <span class="style8">Mobile Auto Detailing</span>
                <input type="checkbox" name="checkbox2[]" value="checkbox" multiple/>
                <br />
                <br />
                  </strong><span class="style9">Moving/Hauling</span>
          <input type="checkbox" name="checkbox3[]" value="checkbox" multiple/>
          <br />
          <br />
                  <span class="style9">Pressure washing</span>
          <input type="checkbox" name="checkbox4[]" value="checkbox" multiple/>
          <br />
          <br />
                  <span class="style9">Window washing</span>
          <input type="checkbox" name="checkbox5[]" value="checkbox" multiple/>
          <br />
          <br />
                  <span class="style9">Window Tinting</span>
          <input type="checkbox" name="checkbox6[]" value="checkbox" multiple/>
          <br />
          <br />
                  <span class="style9">Boat cleaning</span>
          <input type="checkbox" name="checkbox7[]" value="checkbox" multiple/>
          <br />
          <br />
                  <span class="style9">RV cleaning</span>
          <input type="checkbox" name="checkbox8[]" value="checkbox" multiple/>
          <br />
          <br />
                  <span class="style9">Motorcycle cleaning</span>
          <input type="checkbox" name="checkbox9[]" value="checkbox" multiple/>
          <br />
          <br />
          <br />
          <br />
          <input name="SB"  type="button" class="style9" value="Submit" onClick="sendOff();">
        </p>
      </div></label>
      <script language="JavaScript1.2">
    // (C) 2000 www.CodeLifter.com
    // http://www.codelifter.com
    // Free for all users, but leave in this  header
    var good;
    function checkEmailAddress(field) {
    // Note: The next expression must be all on one line...
    //       allow no spaces, linefeeds, or carriage returns!
    var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org) |(\..{2,2}))$)\b/gi);
    if (goodEmail){
       good = true
    } else {
       alert('Please enter a valid e-mail address.')
       field.focus()
       field.select()
       good = false
    function autoTab(startPoint,endPoint){
    if (startPoint.getAttribute&&startPoint.value.length==startPoint.getAttribute("max length"))
    endPoint.focus();
    function checkNumber(phoneNumber){
    var x=phoneNumber;
    var phoneNumber=/(^\d+$)|(^\d+\.\d+$)/
    if (phoneNumber.test(x))
    testResult=true
    else{
    alert("Please enter a valid number.")
    phoneNumber.focus();
    phoneNumber.value="";
    testResult=false
    return (testResult)
    function sendOff(){
       namecheck = document.TheForm.name.value   
       if (namecheck.length <1) {
          alert('Please enter your name.')
          return
       good = false
       checkEmailAddress(document.TheForm.email)
       if ((document.TheForm.email.value ==
            document.TheForm.emx.value)&&(good)){
          // This is where you put your action
          // if name and email addresses are good.
          // We show an alert box, here; but you can
          // use a window.location= 'http://address'
          // to call a subsequent html page,
          // or a Perl script, etc.
          window.location= 'form2mail.php';
       if ((document.TheForm.email.value !=
              document.TheForm.emx.value)&&(good)){
              alert('Both e-mail address entries must match.')
    </script>
    </form>
    <p> </p>
    </body>
    </html>
    and here is the form2mail.php:
    <?php
    # You can use this script to submit your forms or to receive orders by email.
    $MailToAddress = "[email protected]"; // your email address
    $redirectURL = "http://www.chucksmobile.com/thankyou.html"; // the URL of the thank you page.
    $MailSubject = "[Customer Contact Info]"; // the subject of the email
    $sendHTML = FALSE; //set to "false" to receive Plain TEXT e-mail
    $serverCheck = FALSE; // if, for some reason you can't send e-mails, set this to "false"
    # copyright 2006 Web4Future.com =================== READ THIS ===================================================
    # If you are asking for a name and an email address in your form, you can name the input fields "name" and "email".
    # If you do this, the message will apear to come from that email address and you can simply click the reply button to answer it.
    # To block an IP, simply add it to the blockip.txt text file.
    # CHMOD 777 the blockip.txt file (run "CHMOD 777 blockip.txt", without the double quotes)
    # This is needed because the script tries to block the IP that tried to hack it
    # If you have a multiple selection box or multiple checkboxes, you MUST name the multiple list box or checkbox as "name[]" instead of just "name"
    # you must also add "multiple" at the end of the tag like this: <select name="myselectname[]" multiple>
    # you have to do the same with checkboxes
    Web4Future Easiest Form2Mail (GPL).
    Copyright (C) 1998-2006 Web4Future.com All Rights Reserved.
    http://www.Web4Future.com/
    This script was written by George L. & Calin S. from Web4Future.com
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING ===================================================
    $w4fver =  "2.2";
    $ip = ($_SERVER['HTTP_X_FORWARDED_FOR'] == "" ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_FORWARDED_FOR']);
    //function blockIP
    function blockip($ip) {
    $handle = @fopen("blockip.txt", 'a');
    @fwrite($handle, $ip."\n");
    @fclose($handle);
    $w4fx = stristr(file_get_contents('blockip.txt'),getenv('REMOTE_ADDR'));
    if ($serverCheck) {
    if (preg_match ("/".str_replace("www.", "", $_SERVER["SERVER_NAME"])."/i", $_SERVER["HTTP_REFERER"])) { $w4fy = TRUE; } else { $w4fy = FALSE; }
    } else { $w4fy = TRUE; }
    if (($w4fy === TRUE) && ($w4fx === FALSE)) {
    $w4fMessage = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html>\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head><body><font face=3Dverdana size=3D2>";
    if (count($_GET) >0) {
    reset($_GET);
    while(list($key, $val) = each($_GET)) {
      $GLOBALS[$key] = $val;
      if (is_array($val)) {
       $w4fMessage .= "<b>$key:</b> ";
       foreach ($val as $vala) {
        $vala =stripslashes($vala);
        $vala = htmlspecialchars($vala);
        if (trim($vala)) { if (stristr($vala,"Content-Type:") || stristr($vala,"MIME-Version") || stristr($vala,"Content-Transfer-Encoding") || stristr($vala,"bcc:")) { blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } }
        $w4fMessage .= "$vala, ";
       $w4fMessage .= "<br>\n";
      else {
       $val = stripslashes($val);
       if (trim($val)) { if (stristr($val,"Content-Type:") || stristr($val,"MIME-Version") || stristr($val,"Content-Transfer-Encoding") || stristr($val,"bcc:")) { blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } }
       if (($key == "Submit") || ($key == "submit")) { } 
       else {  if ($val == "") { $w4fMessage .= "$key: - <br>\n"; }
         else { $w4fMessage .= "<b>$key:</b> $val<br>\n"; }
    } // end while
    }//end if
    else {
    reset($_POST);
    while(list($key, $val) = each($_POST)) {
      $GLOBALS[$key] = $val;
      if (is_array($val)) {
       $w4fMessage .= "<b>$key:</b> ";
       foreach ($val as $vala) {
        $vala =stripslashes($vala);
        $vala = htmlspecialchars($vala);
        if (trim($vala)) { if (stristr($vala,"Content-Type:") || stristr($vala,"MIME-Version") || stristr($vala,"Content-Transfer-Encoding") || stristr($vala,"bcc:")) {blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } }   
        $w4fMessage .= "$vala, ";
       $w4fMessage .= "<br>\n";
      else {
       $val = stripslashes($val);
       if (trim($val)) { if (stristr($val,"Content-Type:") || stristr($val,"MIME-Version") || stristr($val,"Content-Transfer-Encoding") || stristr($val,"bcc:")) {blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } }
       if (($key == "Submit") || ($key == "submit")) { } 
       else {  if ($val == "") { $w4fMessage .= "$key: - <br>\n"; }
         else { $w4fMessage .= "<b>$key:</b> $val<br>\n"; }
    } // end while
    }//end else
    $w4fMessage .= "<font size=3D1><br><br>\n Sender IP: ".$ip."</font></font></body></html>";
        $w4f_what = array("/To:/i", "/Cc:/i", "/Bcc:/i","/Content-Type:/i","/\n/");
    $name = preg_replace($w4f_what, "", $name);
    $email = preg_replace($w4f_what, "", $email);
    if (!$email) {$email = $MailToAddress;}
    $mailHeader = "From: $name <$email>\r\n";
    $mailHeader .= "Reply-To: $name <$email>\r\n";
    $mailHeader .= "Message-ID: <". md5(rand()."".time()) ."@". ereg_replace("www.","",$_SERVER["SERVER_NAME"]) .">\r\n";
    $mailHeader .= "MIME-Version: 1.0\r\n";
    if ($sendHTML) {
      $mailHeader .= "Content-Type: multipart/alternative;";  
      $mailHeader .= "  boundary=\"----=_NextPart_000_000E_01C5256B.0AEFE730\"\r\n";    
    $mailHeader .= "X-Priority: 3\r\n";
    $mailHeader .= "X-Mailer: PHP/" . phpversion()."\r\n";
    $mailHeader .= "X-MimeOLE: Produced By Web4Future Easiest Form2Mail $w4fver\r\n";
    if ($sendHTML) {
      $mailMessage = "This is a multi-part message in MIME format.\r\n\r\n";
      $mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n";
      $mailMessage .= "Content-Type: text/plain;   charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";  
      $mailMessage .= trim(strip_tags($w4fMessage))."\r\n\r\n";  
      $mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n";  
      $mailMessage .= "Content-Type: text/html;   charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";  
      $mailMessage .= "$w4fMessage\r\n\r\n";  
      $mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730--\r\n";  
    if ($sendHTML === FALSE) {
      $mailHeader .= "Content-Type: text/plain;   charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";  
      $mailMessage .= trim(strip_tags($w4fMessage))."\r\n\r\n";  
    if (!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader)) { echo "Error sending e-mail!";}
    else { header("Location: ".$redirectURL); }
    } else { echo "<center><font face=verdana size=3 color=red><b>ILLEGAL EXECUTION DETECTED!</b></font></center>";}
    ?>
    Thanks in advance,
    Glenn
    [Subject line edited by moderator to indicate nature of request]

    Using PHP to process an online form and send the input by email is very simple. The mail() function takes a minimum of three arguments, namely: the address the mail is being sent to, the subject line, and the body of the email as a single string. The reason some people use scripts like form2mail.php is because they don't have the knowledge or patience to validate the user input to make sure it's safe to send.
    Rather than attempt to trawl through your complex form looking for the problems, I would suggest starting with a couple of simple tests.
    First of all, create a PHP page called mailtest.php containing the following script:
    <?php
    $to = '[email protected]'; // use your own email address
    $subject = 'PHP mail test';
    $message = 'This is a test of the mail() function.';
    $sent = mail($to, $subject, $message);
    if ($sent) {
      echo 'Mail was sent';
    } else {
      echo 'Problem sending mail';
    ?>
    Save the script, upload it to your server, and load it into a browser. If you see "Mail is sent", you're in business. If not, it probably means that the hosting company insists on the fifth argument being supplied to mail(). This is your email address preceded by -f. Change the line of code that sends the mail to this:
    $sent = mail($to, $subject, $message, null, '[email protected]');
    Obviously, replace "[email protected]" with your own email address.
    If this results in the mail being sent successfully, you will need to adapt the code in form2mail.php to accept the fifth parameter. You need to change the following line, which is a few lines from the end of the script:
    if (!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader))
    Change it to this:
    if (!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader, '[email protected]'))
    Again, use your own email address instead of "[email protected]".
    Once you have determined whether you need the fifth argument, test form2mail.php with a very simple form like this:
    <form id="form1" name="form1" method="post" action="form2mail.php">
      <p>
        <label for="name">Name:</label>
        <input type="text" name="name" id="name" />
      </p>
      <p>
        <label for="email">Email:</label>
        <input type="text" name="email" id="email" />
      </p>
      <p>
        <label>
          <input type="checkbox" name="options[]" value="boat cleaning" id="options_0" />
          Boat cleaning</label>
        <br />
        <label>
          <input type="checkbox" name="options[]" value="RV cleaning" id="options_1" />
          RV cleaning</label>
        <br />
        <label>
          <input type="checkbox" name="options[]" value="motorcycle cleaning" id="options_2" />
          Motorcycle cleaning</label>
      </p>
      <p>
        <input type="submit" name="send" id="send" value="Submit" />
      </p>
    </form>
    If that works, you can start to make the form more complex and add back your JavaScript validation.

  • Need help with PHP mail script

    I  have created a  log in system  . In that when the  user completes the  registration process an auto reply(auto-reply@domain)  will generate and  sent this to users email id regarding about the user  name and password  (Lo gin Details). After formal approval from the admin  the user will  get a user activation mail with log in link.
    But , my problem is  these are work only for mail accounts from my  domain  only(test@domain). its not send any of above mentioned details  to other  mail services like gmail or yahoo etc.
    i discussed this   with some others, they said its the problem with your mail function   configuration. but i didn't get any needful information as am a  beginner  in PHP scripting.
    i have contacted this with my  hosting service they said its the  problem with  php mail () function  and use php mailer() instead mail().
    please give me a solution for the same..
    Here am ataching my code..
    <?php
    include 'dbc.php';
    $err = array();
    if($_POST['doRegister'] == 'Register')
    foreach($_POST as $key => $value) {
        $data[$key] = filter($value);
    if(empty($data['full_name']) || strlen($data['full_name']) < 4)
    $err[] = "ERROR - Invalid name. Please enter atleast 3 or more characters for your name";
    //header("Location: register.php?msg=$err");
    //exit();
    // Validate User Name
    if (!isUserID($data['user_name'])) {
    $err[] = "ERROR - Invalid user name. It can contain alphabet, number and underscore.";
    //header("Location: register.php?msg=$err");
    //exit();
    // Validate Email
    if(!isEmail($data['usr_email'])) {
    $err[] = "ERROR - Invalid email address.";
    //header("Location: register.php?msg=$err");
    //exit();
    // Check User Passwords
    if (!checkPwd($data['pwd'],$data['pwd2'])) {
    $err[] = "ERROR - Invalid Password or mismatch. Enter 5 chars or more";
    //header("Location: register.php?msg=$err");
    //exit();
    $user_ip = $_SERVER['REMOTE_ADDR'];
    // stores sha1 of password
    $sha1pass = PwdHash($data['pwd']);
    // Automatically collects the hostname or domain  like example.com)
    $host  = $_SERVER['HTTP_HOST'];
    $host_upper = strtoupper($host);
    $path   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
    // Generates activation code simple 4 digit number
    $activ_code = rand(1000,9999);
    $usr_email = $data['usr_email'];
    $user_name = $data['user_name'];
    $rs_duplicate = mysql_query("select count(*) as total from users where user_email='$usr_email' OR user_name='$user_name'") or die(mysql_error());
    list($total) = mysql_fetch_row($rs_duplicate);
    if ($total > 0)
    $err[] = "ERROR - The username/email already exists. Please try again with different username and email.";
    if(empty($err)) {
    $sql_insert = "INSERT into `users`
                  (`full_name`,`user_email`,`pwd`,`address`,`tel`,`fax`,`website`,`date`,`users_ip`,`activa tion_code`,`country`,`user_name`
                VALUES
                ('$data[full_name]','$usr_email','$sha1pass','$data[address]','$data[tel]','$data[fax]',' $data[web]'
                ,now(),'$user_ip','$activ_code','$data[country]','$user_name'
    mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error());
    $user_id = mysql_insert_id($link); 
    $md5_id = md5($user_id);
    mysql_query("update users set md5_id='$md5_id' where id='$user_id'");
    //    echo "<h3>Thank You</h3> We received your submission.";
    if($user_registration)  {
    $a_link = "
    *****ACTIVATION LINK*****\n
    http://$host$path/activate.php?user=$md5_id&activ_code=$activ_code
    } else {
    $a_link =
    "Your account is *PENDING APPROVAL* and will be soon activated the administrator.
    $message =
    "Hello \n
    Thank you for registering with us. Here are your login details...\n
    User ID: $user_name
    Email: $usr_email \n
    Passwd: $data[pwd] \n
    $a_link
    Thank You
    Administrator
    $host_upper
    THIS IS AN AUTOMATED RESPONSE.
    ***DO NOT RESPOND TO THIS EMAIL****
        mail($usr_email, "Login Details", $message,
        "From: \"Member Registration\" <auto-reply@$host>\r\n" .
         "X-Mailer: PHP/" . phpversion());
      header("Location: thankyou.php"); 
      exit();
    ?>

    I  have created a  log in system  . In that when the  user completes the  registration process an auto reply(auto-reply@domain)  will generate and  sent this to users email id regarding about the user  name and password  (Lo gin Details). After formal approval from the admin  the user will  get a user activation mail with log in link.
    But , my problem is  these are work only for mail accounts from my  domain  only(test@domain). its not send any of above mentioned details  to other  mail services like gmail or yahoo etc.
    i discussed this   with some others, they said its the problem with your mail function   configuration. but i didn't get any needful information as am a  beginner  in PHP scripting.
    i have contacted this with my  hosting service they said its the  problem with  php mail () function  and use php mailer() instead mail().
    please give me a solution for the same..
    Here am ataching my code..
    <?php
    include 'dbc.php';
    $err = array();
    if($_POST['doRegister'] == 'Register')
    foreach($_POST as $key => $value) {
        $data[$key] = filter($value);
    if(empty($data['full_name']) || strlen($data['full_name']) < 4)
    $err[] = "ERROR - Invalid name. Please enter atleast 3 or more characters for your name";
    //header("Location: register.php?msg=$err");
    //exit();
    // Validate User Name
    if (!isUserID($data['user_name'])) {
    $err[] = "ERROR - Invalid user name. It can contain alphabet, number and underscore.";
    //header("Location: register.php?msg=$err");
    //exit();
    // Validate Email
    if(!isEmail($data['usr_email'])) {
    $err[] = "ERROR - Invalid email address.";
    //header("Location: register.php?msg=$err");
    //exit();
    // Check User Passwords
    if (!checkPwd($data['pwd'],$data['pwd2'])) {
    $err[] = "ERROR - Invalid Password or mismatch. Enter 5 chars or more";
    //header("Location: register.php?msg=$err");
    //exit();
    $user_ip = $_SERVER['REMOTE_ADDR'];
    // stores sha1 of password
    $sha1pass = PwdHash($data['pwd']);
    // Automatically collects the hostname or domain  like example.com)
    $host  = $_SERVER['HTTP_HOST'];
    $host_upper = strtoupper($host);
    $path   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
    // Generates activation code simple 4 digit number
    $activ_code = rand(1000,9999);
    $usr_email = $data['usr_email'];
    $user_name = $data['user_name'];
    $rs_duplicate = mysql_query("select count(*) as total from users where user_email='$usr_email' OR user_name='$user_name'") or die(mysql_error());
    list($total) = mysql_fetch_row($rs_duplicate);
    if ($total > 0)
    $err[] = "ERROR - The username/email already exists. Please try again with different username and email.";
    if(empty($err)) {
    $sql_insert = "INSERT into `users`
                  (`full_name`,`user_email`,`pwd`,`address`,`tel`,`fax`,`website`,`date`,`users_ip`,`activa tion_code`,`country`,`user_name`
                VALUES
                ('$data[full_name]','$usr_email','$sha1pass','$data[address]','$data[tel]','$data[fax]',' $data[web]'
                ,now(),'$user_ip','$activ_code','$data[country]','$user_name'
    mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error());
    $user_id = mysql_insert_id($link); 
    $md5_id = md5($user_id);
    mysql_query("update users set md5_id='$md5_id' where id='$user_id'");
    //    echo "<h3>Thank You</h3> We received your submission.";
    if($user_registration)  {
    $a_link = "
    *****ACTIVATION LINK*****\n
    http://$host$path/activate.php?user=$md5_id&activ_code=$activ_code
    } else {
    $a_link =
    "Your account is *PENDING APPROVAL* and will be soon activated the administrator.
    $message =
    "Hello \n
    Thank you for registering with us. Here are your login details...\n
    User ID: $user_name
    Email: $usr_email \n
    Passwd: $data[pwd] \n
    $a_link
    Thank You
    Administrator
    $host_upper
    THIS IS AN AUTOMATED RESPONSE.
    ***DO NOT RESPOND TO THIS EMAIL****
        mail($usr_email, "Login Details", $message,
        "From: \"Member Registration\" <auto-reply@$host>\r\n" .
         "X-Mailer: PHP/" . phpversion());
      header("Location: thankyou.php"); 
      exit();
    ?>

  • How do i change the path of data ajax false from returning to homepage, when using a PHP mail form in jquery mobile?

    I have a put a php mail form in the quote page of my mobile site. However when i send the form it returns to the route page rather than the quote page, i have used the data ajax false action as i dont want to send via ajax. i have left the thanks page blank as i want it to remain on the same page showing sent or declined message.  Can someone help please? 
    <?php
    // OPTIONS - PLEASE CONFIGURE THESE BEFORE USE!
    $yourEmail = "[email protected]"; // the email address you wish to receive these mails through
    $yourWebsite = "www.firstcalltransport.co.uk"; // the name of your website
    $thanksPage = ''; // URL to 'thanks for sending mail' page; leave empty to keep message on the same page
    $maxPoints = 4; // max points a person can hit before it refuses to submit - recommend 4
    $requiredFields = "name,email,collection,delivery,comments"; // names of the fields you'd like to be required as a minimum, separate each field with a comma
    // DO NOT EDIT BELOW HERE
    $error_msg = array();
    $result = null;
    $requiredFields = explode(",", $requiredFields);
    function clean($data) {
      $data = trim(stripslashes(strip_tags($data)));
      return $data;
    function isBot() {
      $bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot", "Teoma", "alexa", "froogle", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz");
      foreach ($bots as $bot)
      if (stripos($_SERVER['HTTP_USER_AGENT'], $bot) !== false)
      return true;
      if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ")
      return true;
      return false;
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
      if (isBot() !== false)
      $error_msg[] = "No bots please! UA reported as: ".$_SERVER['HTTP_USER_AGENT'];
      // lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score..
      // score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam
      $points = (int)0;
      foreach ($badwords as $word)
      if (
      strpos(strtolower($_POST['comments']), $word) !== false ||
      strpos(strtolower($_POST['name']), $word) !== false
      $points += 2;
      if (strpos($_POST['comments'], "http://") !== false || strpos($_POST['comments'], "www.") !== false)
      $points += 2;
      if (isset($_POST['nojs']))
      $points += 1;
      if (preg_match("/(<.*>)/i", $_POST['comments']))
      $points += 2;
      if (strlen($_POST['name']) < 3)
      $points += 1;
      if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500))
      $points += 2;
      if (preg_match("/[bcdfghjklmnpqrstvwxyz]{7,}/i", $_POST['comments']))
      $points += 1;
      // end score assignments
      foreach($requiredFields as $field) {
      trim($_POST[$field]);
      if (!isset($_POST[$field]) || empty($_POST[$field]) && array_pop($error_msg) != "Please fill in all the required fields and submit again.\r\n")
      $error_msg[] = "Please fill in all the required fields and submit again.";
      if (!empty($_POST['name']) && !preg_match("/^[a-zA-Z-'\s]*$/", stripslashes($_POST['name'])))
      $error_msg[] = "The name field must not contain special characters.\r\n";
      if (!empty($_POST['email']) && !preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+ ' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i', strtolower($_POST['email'])))
      $error_msg[] = "That is not a valid e-mail address.\r\n";
      if (!empty($_POST['url']) && !preg_match('/^(http|https):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\ /?/i', $_POST['url']))
      $error_msg[] = "Invalid website url.\r\n";
      if ($error_msg == NULL && $points <= $maxPoints) {
      $subject = "Automatic Form Email";
      $message = "You received this e-mail message through your website: \n\n";
      foreach ($_POST as $key => $val) {
      if (is_array($val)) {
      foreach ($val as $subval) {
      $message .= ucwords($key) . ": " . clean($subval) . "\r\n";
      } else {
      $message .= ucwords($key) . ": " . clean($val) . "\r\n";
      $message .= "\r\n";
      $message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n";
      $message .= 'Browser: '.$_SERVER['HTTP_USER_AGENT']."\r\n";
      $message .= 'Points: '.$points;
      if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) {
      $headers   = "From: $yourEmail\r\n";
      } else {
      $headers   = "From: $yourWebsite <$yourEmail>\r\n";
      $headers  .= "Reply-To: {$_POST['email']}\r\n";
      if (mail($yourEmail,$subject,$message,$headers)) {
      if (!empty($thanksPage)) {
      header("Location: $thanksPage");
      exit;
      } else {
      $result = 'Your mail was successfully sent.';
      $disable = true;
      } else {
      $error_msg[] = 'Your mail could not be sent this time. ['.$points.']';
      } else {
      if (empty($error_msg))
      $error_msg[] = 'Your mail looks too much like spam, and could not be sent this time. ['.$points.']';
    function get_data($var) {
      if (isset($_POST[$var]))
      echo htmlspecialchars($_POST[$var]);
    ?>
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <link href="CSS/stylesheetnew.css" rel="stylesheet" type="text/css">
    <link href="../jquery-mobile/jquery.mobile-1.0a3.min.css" rel="stylesheet" type="text/css">
    <script src="../jquery-mobile/jquery-1.5.min.js" type="text/javascript"></script>
    <script src="../jquery-mobile/jquery.mobile-1.0a3.min.js" type="text/javascript"></script>
    <style type="text/css">
      p.error, p.success {
      font-weight: bold;
      padding: 10px;
      border: 1px solid;
      p.error {
      background: #ffc0c0;
      color: #F00;
      p.success {
      background: #b3ff69;
      color: #4fa000;
    </style>
    </head>
    <body>
    <div data-role="page" id="home">
      <div data-role="header" data-position="fixed">
       <h1>FIRSTCALL TRANSPORT</h1>
    </div>
        <div data-role="navbar" data-position="fixed">
                                    <ul>
                                      <li><a href="#about">About</a></li>
                                      <li><a href="#services">Services</a></li>
                                      <li><a href="#contact">Contact</a></li>
                                      <li><a href="#quote">Quote</a></li>
                                    </ul>
      </div>
      <div data-role="content"> </div>
         <div data-role="footer" data-position="fixed" > </div>
    </div>
    </div>
    <div data-role="page" id="quote">
      <div data-role="header" data-position="fixed">
        <h1>GET A QUOTE</h1>
      </div>
      <div data-role="content">
       <?php
    if (!empty($error_msg)) {
      echo '<p class="error">ERROR: '. implode("<br />", $error_msg) . "</p>";
    if ($result != NULL) {
      echo '<p class="success">'. $result . "</p>";
    ?>
    <form action="<?php echo basename(__FILE__); ?>" method="post" data-ajax="false"  >
    <noscript>
      <p><input type="hidden" name="nojs" id="nojs" /></p>
    </noscript>
    <p>
      <label for="name">Name: *</label>
      <input type="text" name="name" id="name" value="<?php get_data("name"); ?>" /><br />
      <label for="email">E-mail: *</label>
      <input type="text" name="email" id="email" value="<?php get_data("email"); ?>" /><br />
            <label for="company">Company:</label>
      <input type="text" name="company" id="company" value="<?php get_data("company"); ?>" /><br />
      <label for="collection">Collection: *</label>
      <input type="text" name="collection" id="collection" value="<?php get_data("collection"); ?>" /><br />
        <label for="delivery">Delivery: *</label>
      <input type="text" name="delivery" id="delivery" value="<?php get_data("delivery"); ?>" /><br />
      <label for="comments">Message: *</label>
      <textarea name="comments" id="comments" rows="5" cols="20"><?php get_data("comments"); ?></textarea><br />
      <input type="submit" name="submit" id="submit" value="Send" <?php if (isset($disable) && $disable === true) echo ' disabled="disabled"'; ?> />
    </p>
    </form>  </div>
         <div data-role="footer" >  </div>
      </div>
      </div>           
    </body>
    </html>

    My wife has left me for four weeks, favouring to be with our son who lives 4,000 km away. I now have to cook for myself and the steaks taste horrible. What am I doing wrong?
    If you do not know what I have (not) done to make the steak taste horrible, my question is as hard to answer as your question above.
    Please give us more info like giving us the code that sends the page to the homepage rather than to the previous page.

  • PHP form help - results not appearing in email

    Hi I have set up a simple entry form, and I am submiting it
    using PHP to my email address, It works well when you fill the form
    in and send it, I receive the email however the email only displays
    the questions and not the answers that have been filled in on the
    form. Itss driving me crazy as top why this is not working. Can
    someone please help?
    here is my form code, both form and PHP. Thanx

    I haven't checked the form, but I had a similar problem with
    my server when they upgraded their systems recently. I would
    receive the email, but it was blank.
    Th reason was ...
    As long as your scripts do not need "register_globals" they
    will work.
    The default php mail command works. Again - no
    "register_globals".
    A lot of old and lazy written scripts rely on it. But it is a
    major
    security risk - even more so on shared servers - and as such
    has been
    disabled by default in PHP since version 3.0.3.

  • SMTP Authorization code for PHP Mail Form

    Can anyone help me in figuring out the correct way to incorporate the SMTP authentication into a form? I am having a lot of trouble in getting my forms to send with this format. My code for my php action page is below. I have my correct information where i included *******. Please let me know what i have wrong.
    CODE STARTS HERE
    <?php
    //new function
    $to = "*******";
    $nameto = "LTL Freight Shop";
    $from = "*******";
    $namefrom = "LTL Freight Shop";
    $subject = "Account Request";
    authSendEmail($from, $namefrom, $to, $nameto, $subject, $message);
    ?>
    <?php
    $recipient  = "*******";
    //$subject = "Account Request";
    $companyname = check_input($_POST['CompanyName'], "Enter your company name");
    $firstname  = check_input($_POST['FirstName'], "Enter your first name");
    $lastname  = check_input($_POST['LastName'], "Enter your last name");
    $phone  = check_input($_POST['PhoneNumber'], "Enter your phone number");
    $fax  = check_input($_POST['FaxNumber']);
    $email  = check_input($_POST['Email'], "Enter your email");
    $address  = check_input($_POST['StreetAddress'], "Enter your address");
    $city  = check_input($_POST['City'], "Enter your city");
    $state  = check_input($_POST['State'], "Enter your state");
    $zipcode  = check_input($_POST['ZipCode'], "Enter your zip code");
    $country  = check_input($_POST['Country'], "Enter your country");
    $yearsinbusiness  = check_input($_POST['YearsinBusiness'], "Enter your years in business");
    $typeofindustry  = check_input($_POST['TypeofIndustry'], "Enter your type of industry");
    $multiplelocations    = check_input($_POST['MultipleLocations']);
    $numberoflocations  = check_input($_POST['LocationsCount']);
    $ltl  = check_input($_POST['ServicesLTL']);
    $ftl  = check_input($_POST['ServicesFTL']);
    $domesticparcel  = check_input($_POST['ServicesDomesticParcel']);
    $intlparcel  = check_input($_POST['ServicesInternationalParcel']);
    $airfreight  = check_input($_POST['ServicesAirFreight']);
    $oceanfreight  = check_input($_POST['ServicesOceanFreight']);
    $other  = check_input($_POST['ServicesOther']);
    $none  = check_input($_POST['ServicesNone']);
    $volume  = check_input($_POST['TypicalVolume'], "Enter your typical volume");
    $carrier  = check_input($_POST['CurrentCarrier'], "Enter your current carrier");
    $class  = check_input($_POST['AverageClass'], "Enter your average class");
    $weight  = check_input($_POST['AverageWeight'], "Enter your average weight");
    $process   = check_input($_POST['Process']);
    $hearabout = check_input($_POST['HearAbout']);
    $comments = check_input($_POST['Comments']);
    if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
        show_error("E-mail address not valid");
    $message = "You have received an account request from:
    Company Name: $companyname
    First Name: $firstname
    Last Name: $lastname
    Phone Number: $phone
    Fax Number: $fax
    E-mail: $email
    Street Address: $address
    City: $city
    State: $state
    Zip Code: $zipcode
    Country: $country
    Years in Business: $yearsinbusiness
    Type of Industry: $typeofindustry
    Multiple Locations: $multiplelocations
    Number of Locations: $numberoflocations
    Services they use: $ltl, $ftl, $domesticparcel, $intlparcel, $airfreight, $oceanfreight, $other, $none
    Typical Volume: $volume
    Current Carrier: $carrier
    Average Class: $class
    Average Weight: $weight
    How they currently process: $process
    How they heard about us: $hearabout
    Comments: $comments
    End of message
    //ini_set("SMTP","smtp.emailsrvr.com");
    //ini_set("SMTP_PORT", 25);
    //ini_set("sendmail_from","*******");
    //mail($recipient, $subject, $message);
    function check_input($data, $problem='')
        $data = trim($data);
        $data = stripslashes($data);
        $data = htmlspecialchars($data);
        if ($problem && strlen($data) == 0)
            show_error($problem);
        return $data;
    function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message)
    $smtpServer = "smtp.emailsrvr.com";
    $port = "25";
    $timeout = "30";
    $username = "********";
    $password = "********";
    $localhost = "smtp.emailsrvr.com";
    $newLine = "\r\n";
    $smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout);
    $smtpResponse = fgets($smtpConnect, 515);
    if(empty($smtpConnect))
    $output = "Failed to connect: $smtpResponse";
    return $output;
    else
    $logArray['connection'] = "Connected: $smtpResponse";
    fputs($smtpConnect,"AUTH LOGIN" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['authrequest'] = "$smtpResponse";
    fputs($smtpConnect, base64_encode($username) . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['authusername'] = "$smtpResponse";
    fputs($smtpConnect, base64_encode($password) . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['authpassword'] = "$smtpResponse";
    fputs($smtpConnect, "HELO $localhost" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['heloresponse'] = "$smtpResponse";
    fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['mailfromresponse'] = "$smtpResponse";
    fputs($smtpConnect, "RCPT TO: $to" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['mailtoresponse'] = "$smtpResponse";
    fputs($smtpConnect, "DATA" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['data1response'] = "$smtpResponse";
    $headers = "MIME-Version: 1.0" . $newLine;
    $headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine;
    $headers .= "To: $nameto <$to>" . $newLine;
    $headers .= "From: $namefrom <$from>" . $newLine;
    fputs($smtpConnect, "To: $to\nFrom: $from\nSubject: $subject\n$headers\n\n$message\n.\n");
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['data2response'] = "$smtpResponse";
    fputs($smtpConnect,"QUIT" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['quitresponse'] = "$smtpResponse";
    function show_error($myError)
    ?>
        <html>
        <body>
        <b>Please correct the following error:</b><br />
        <?php echo $myError; ?>
        </body>
        </html>
    <?php
    exit();
    ?>

    I have tried the standard PHP mail function and it doesnt seem to work. Here is my most recent warning or error message.
    Warning: mail() [function.mail]: SMTP server response: 554 5.7.1 <*****>: Sender address rejected: Access denied in D:\inetpub\vhosts\ltlfreightshop.com\httpdocs\requestaccount.php on line 78
    I had the standard mailing set up but it wouldnt ever send and when i set up just the form, it requires the default email client. Am i wrong to assume that i need the SMTP authentication?
    I am not sure about the sockets being enabled. We currently outsource our web hosting and email hosting. I cannot find the phpinfo(), where would this be?
    Thanks,
    Ben

  • ANN: Tutorial on using PHP mail() safely

    Time and time again, I see requests for help with PHP mail() scripts that use a very common, but insecure technique: inserting an unfiltered email address into the From header.
    There are two things wrong with this:
    The From header is meant to indicate where the email originates. When using the mail() function, it's your website that originates the message, not whoever submits the form. To reply to the person submitting the form, you should use the Reply-to header.
    You should NEVER put unfiltered user input into the header argument of the mail() function.
    I have created a tutorial explaining how to remain safe by using the PHP filter_input() function to check the validity of an email field before creating a Reply-to header. It's on my website at http://foundationphp.com/tutorials/email.php.

    Thanks, CF. I've been teaching how to avoid email header injection in my books for years, but I've noticed so many people still using insecure code that I decided it was time for an online tutorial.

  • ?php mail.. position question

    Fairly standard question that I have noticed lots of .asp
    comments on forum.
    I have a registration form that inserts a record and then
    re-directs to a register success page.
    I also want the registersuccess page (or alternatively form
    page) to automatically send an e-mail to me, including certain
    information entered into the form fields - namely the unique
    identifier (email address). This I can set as a hyperlink to allow
    me to connect directly to that record on-line.
    I've sussed that this is the line I want to use in the
    registersuccess page:
    <?php mail ("[email protected]", "There is a new Site
    Registration", $email);?>
    Call me stupid but I cannot work out how to propogate
    "$email" from a form field variable in the previous page if no
    information is being passed from the previous page.
    I have tried to include ?EMAIL=<?php echo
    $POST_VARS['emailtextfield'];?> into the redirection address
    when the form is submitted but I get an error.
    I am now trying to find out where I can put my "mail" code in
    the first form page but am having great difficulty as it is now
    complicated by form checks and duplicate checks.
    Can anyone help?

    On 22 Mar 2007 in macromedia.dreamweaver.appdev,
    RichardODreamweaver
    wrote:
    > I am now trying to find out where I can put my "mail"
    code in the
    > first form page but am having great difficulty as it is
    now
    > complicated by form checks and duplicate checks.
    In the script which processes the form (<form
    method="POST"
    action="thisisthefileyouwant.php">), find where the insert
    behavior
    ends. Just after that, you put your code to send the email to
    you.
    The visitor's entered email will still be in
    $_POST['emailFieldName'].
    So:
    <?php
    // Code to insert data ends here
    $to = '[email protected]';
    $subject = 'Record inserted';
    $body = 'This record was inserted: EMail: ' .
    $_POST['emailFieldName'];
    mail($to, $subject, $body);
    ?>
    Joe Makowiec
    http://makowiec.net/
    Email:
    http://makowiec.net/contact.php

  • PHP mail not sending correctly, instead Dovecot delivers to _www mailbox

    I've already searched  discussions and the web to no avail.
    Since moving my websites over to Mac OS X Server Snow Lepard 10.6.1 my PHP mail forms don't work correctly. They should send mail (from Wordpress 2.8.4 and Drupal 5.x) to a specified mail address. One of the recipient's domains is mail hosted on the same server, the other one isn't. Mail itself works perfectly.
    Instead of PHP sending mail to the correct mail address the mail is delivered via dovecot to a local mailbox for the _www user which is of course undesired.
    I can't find anything helpful in the logs of the mailservices and apache. (Even with debug)
    I'm using the standard PHP 5.3 included with Mac OS X Server and use SMTP via localhost to send mail in php.ini.
    Any hints on where to further investigate the problem? It's kind of annoying having to use a terminal as root to dig into the forms (not)mailed to me by directly looking at the dovecot store.
    Best regards
    Pepi

    Have you tried and traced the mail messages through mail.log?

  • PHP mail issues with Muse Forms

    I've been trying to findout why my forms are not being sent from my Muse forms. I have spoken with Adobe through the forums and they tell me it's an issue with my Hosting, I've soken with my Hosting, and they said it's an issue with Adobe Muse forms. The bottom line is, I'm in the middle, with forms still not sending.
    The latest information I have had back from my Hosting company - UKFast:
    EMAIL 1:
    Regarding your issue: I'm able to see from the logs on the server that the mail service is up and running and listening for mail connections. Furthermore, I have placed a simple PHP mailer script in /root/testmail.php which sends a quick test message to my mailbox here at UKFast.
    I can see that when sending a message through this script, the message passes through your server correctly and is successfully delivered to my mailbox. Here's an example from the logs:
    2013-06-27 10:49:35 cwd=/root 3 args: /usr/sbin/sendmail -t -i
    2013-06-27 10:49:35 1Us8pb-0001RE-LQ <= [email protected] U=root P=local S=437 T="Test mail" for [email protected]
    2013-06-27 10:49:35 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1Us8pb-0001RE-LQ
    2013-06-27 10:49:55 1Us8pb-0001RE-LQ => <my email> R=lookuphost T=remote_smtp H=mx02.filter.magicmail.co.uk [81.201.128.59]
    2013-06-27 10:49:55 1Us8pb-0001RE-LQ Completed
    To better advise of the cause to your issue, would you be able to provide some accurate time and dates for messages that you have tried to send. With that information, I should be able to pinpoint the message sending attempts in the logs and hopefully unearth the underlying issue stopping the mail going through for you.
    EMAIL 2:
    I have just tested your script for you and it seems the form does not push to the mailqueue as it should.
    We have managed to establish that Mail is working on the server and PHP can push to it, as per Joe's previous response, thus this is looking like an issue with the code of the page.
    Can someone from Adobe please respond to this, UKFast are saying it's not them, and to be honest, I did run your PHP server test on my server and it scored 3 ticks, all working. So whats going on? I neeed the form function, can someone make it work, or tell me whats needed on my server to make it work.

    I am facing same issue.  Even my host provider could not help me. All my inputs are corrent.
    Some php specialist told me, you have to write smtp details in php.  I am using muse because I do not know any coding.
    What is SQL configuration and how to fix this form issue.  Expection some guidence from Muse experts...

  • PHP mail() function not working

    Hello, I am having a problem sending mail with php while hosting my own website with apache on my mac. First of all I would like to note that I do not have a large background with web hosting and php. Everything that I did so far was just suggestions from online articles and other forums, so please include detail with any answers.
    I have apache started, and my website hosted just fine. I can also view php pages so I know php is running too. My problem is using the php mail() function.
    I have a simple form in my site who's action attribute is set to results.php. In the results.php file I have the mail() function (along with html code displaying "thank you...blah blah blah") sending info from the form to my email address. I never get an error on the php side, but my mail never gets sent.
    Is there some type of setting in a config file that need to be turned on or changed?
    Here is what I have done/modified so far from my research from online articles. i dont know what some of them mean, but followed the steps correctly:
    Edited the /etc/hostconfig file and added the line MAILSERVER=-YES-
    Edited the /etc/postfix/main.cf file and uncommented the #myhostname = ...line and made it "myhostname = localhost" (without quotes)
    Edited the php.ini file to the following - The line under where it says
    ; For unix only. You may supply arguments as well (default: "sendmail -t -i")
    Sendmail_path = usr/sbin/sendmail -t -i
    I opened the mail.log file and here are some entries from the other day:
    Code:
    Jul 9 08:16:50 new-host postfix/master[689]: daemon started -- version 2.4.3, configuration /etc/postfix
    Jul 9 08:16:50 new-host postfix/qmgr[691]: 4B4DC2E8331: from=<[email protected]>, size=323, nrcpt=1 (queue active)
    Jul 9 08:16:50 new-host postfix/qmgr[691]: 7A8242EE3C0: from=<[email protected]>, size=280, nrcpt=1 (queue active)
    Jul 9 08:16:50 new-host postfix/qmgr[691]: B1C052EE3C4: from=<[email protected]>, size=280, nrcpt=1 (queue active)
    Jul 9 08:16:50 new-host postfix/qmgr[691]: C281C2EE3C5: from=<[email protected]>, size=327, nrcpt=1 (queue active)
    Jul 9 08:16:50 new-host postfix/smtp[694]: 4B4DC2E8331: to=<[email protected]>, relay=relay.verizon.net[206.46.232.11]:25, delay=213262, delays=213261/0.05/0.86/0, dsn=4.0.0, status=deferred (host relay.verizon.net[206.46.232.11] refused to talk to me: 571 Email from 74.102.108.224 is currently blocked by Verizon Online's anti-spam system. The email sender or Email Service Provider may visit http://www.verizon.net/whitelist and request removal of the block. 100709)
    Jul 9 08:16:51 new-host postfix/pickup[690]: 0F5D22EE4DB: uid=70 from=<_www>
    Jul 9 08:16:51 new-host postfix/cleanup[692]: 0F5D22EE4DB: message-id=<20100709121651.0F5D22EE4DB@localhost>
    Jul 9 08:16:51 new-host postfix/qmgr[691]: 0F5D22EE4DB: from=<[email protected]>, size=333, nrcpt=1 (queue active)
    Jul 9 08:16:51 new-host postfix/smtp[695]: 7A8242EE3C0: to=<[email protected]>, relay=relay.verizon.net[206.46.232.11]:25, delay=27074, delays=27073/0.02/1.1/0, dsn=4.0.0, status=deferred (host relay.verizon.net[206.46.232.11] refused to talk to me: 571 Email from 74.102.108.224 is currently blocked by Verizon Online's anti-spam system. The email sender or Email Service Provider may visit http://www.verizon.net/whitelist and request removal of the block. 100709)
    Jul 9 08:16:51 new-host postfix/smtp[697]: C281C2EE3C5: to=<[email protected]>, relay=relay.verizon.net[206.46.232.11]:25, delay=26817, delays=26816/0.02/1.1/0, dsn=4.0.0, status=deferred (host relay.verizon.net[206.46.232.11] refused to talk to me: 571 Email from 74.102.108.224 is currently blocked by Verizon Online's anti-spam system. The email sender or Email Service Provider may visit http://www.verizon.net/whitelist and request removal of the block. 100709)
    Jul 9 08:16:51 new-host postfix/smtp[696]: B1C052EE3C4: to=<[email protected]>, relay=relay.verizon.net[206.46.232.11]:25, delay=27174, delays=27173/0.01/1.1/0, dsn=4.0.0, status=deferred (host relay.verizon.net[206.46.232.11] refused to talk to me: 571 Email from 74.102.108.224 is currently blocked by Verizon Online's anti-spam system. The email sender or Email Service Provider may visit http://www.verizon.net/whitelist and request removal of the block. 100709)
    Jul 9 08:17:23 new-host postfix/smtp[694]: connect to mx1.comcast.net[76.96.62.116]: Operation timed out (port 25)
    Jul 9 08:17:50 new-host postfix/master[689]: master exit time has arrived
    Any other suggestions on how to get this to work? I have also created a simple php file that sends mail without retreiving info from a form and also tried using several different email addresses to send to and from, but still nothing

    Edited the /etc/postfix/main.cf file and uncommented the #myhostname = ...line and made it "myhostname = localhost" (without quotes) Change that to mail.yourispname.com Then run sudo postfix reload and see if it sends mail. The reason being, is that you don't have a fully qualified domain name.
    And make that reflective in your mail() function file/template.
    Message was edited by: doug pennington

  • Multiple Email Accounts Don't Seem Possible. Yet Mail Help Says It is!

    Hi,
    If you go to the Mail help menu and type in "multiple", the result shows that you can enter multiple email address into an account during setup, separated by commas. Great if you have several emails under the same domain ([email protected], [email protected], etc.)
    The problem is this - the User Name is the full email address, so although I can enter my four email addresses under one domain, I cannot enter them as four separate user names, only one will work.
    Am I missing something here? It's got me confused!
    Thanks for any replies.
    Hugh

    Using an IMAP e-mail where you have several email addresses say ,...... @mac.com, ,[email protected] and [email protected] all pointing at the same server inbox yes you can use the comma separation method.
    Emails sent to any of those addresses arrive on your computer altogether as YOU have just ONE user name !
    If however you have differing POP and/or IMAP accounts each with differing user names POP inboxes and even SMTP sending systems you will have to set up each email account one by one.
    Mail will allow you to have them combined into a single inbox on your computer.
    You will also notice a triangle appears to the left of the inbox ,click on this and you will be presented with individual account inboxes within the main inbox

  • Keep being asked for password: Mail Help unhelpful

    Last week I had to trash my keychains/passwords on the recommendation of Skype help. It solved my immediate problem but now I get asked for a password every time I launch Mail.
    I've tried Mail help and got the following advice:
    "To change the keychain lock settings:
    Open Keychain Access, located in Applications/Utilities (or click the link provided on this page).
    Select your login keychain, choose Edit > "Change Settings for Keychain 'login'."
    To reduce the number of requests for your keychain password, deselect the option for the number of minutes of inactivity before the keychain is locked, or increase the number of minutes. You can also deselect "Lock when sleeping" option."
    Trouble is, I see nothing that resembles a "login keychain".
    Is the above the advice I need. If yes, what/where is my login keychain; if no, what now?

    Thanks for the feedback. This means the login keychain itself was "there", just inaccessible for some reason. The actual keychains are stored in one of the following locations, depending on their applicability:
    /System/Library/Keychains/
    /Library/Keychains/
    ~/Library/Keychains/
    login, in particular, being different for each user, is stored in ~/Library/Keychains/.
    On my system, the System keychain is stored in /Library/Keychains/. Do you see a System keychain in more than one of the aforementioned locations? Maybe that's the reason you see more than one instance of it in Keychain Access.
    I'm wondering now if the problem was just that there was something wrong with the ~/Library/Preferences/com.apple.keychainaccess.plist preferences file. Guess we'll never know what happened here.
    Note: For those not familiarized with the ~/ notation, it refers to the user's home folder. You can easily locate any of the folders referred to in this post by copying the file path here, doing Go > Go to Folder in the Finder, and pasting the file path there.

  • Why doesn't JavaMail work, but PHP mailer does?

    I am trying to use JavaMail to send emails from my webserver. I've plugged in the host and the addresses are valid, but I am getting 550 errors. I've searched and found that I should change a setting on my mail server to allow relays from my webserver. However, we have a PHP mailer working on our webserver now, so presumably that relay is already in there. Why does the PHP work but the JavaMail doesn't?

    Can you turn on session debugging and post the protocol trace that shows the failure?
    The error codes alone are not enough, you usually need to look at the message included
    with the error code.
    Also, have you found the JavaMail FAQ?

  • How to get PHP mail() function to WORK?

    The topic title speaks for itself. I only want the exact following code to actually send an e-mail, just as it does on any external server:
    <?php
    mail(<i>an e-mail address</i>, <i>a subject</i>, <i>some text</i>);
    ?>
    Is it possible?
    I have the sendmail_path set to /usr/sbin/sendmail -t -i in php.ini, and MAILSERVER=-YES- in hostconfig.
    I would like to avoid using sendmail's -f option if possible (this does not work for all e-mail addresses anyway).
    Mac mini Core Duo   Mac OS X (10.4.7)  

    Hi Neithan,
       If, as your profile indicates, you are using Tiger, you are using postfix when you use the "sendmail" command. Sendmail is no longer installed but postfix comes with an "emulator" to keep legacy stuff from breaking. It's still a good command line method for sending mail.
       I'm not sure if setting MAILSERVER=-YES- causes postfix to listen on the smtp port or just for local connections. However, I thought that local connections were sufficient to send mail. Try it and if it doesn't work use Postfix Enabler. Just remember that changing the hostconfig file doesn't take effect until the next reboot. (or run of SystemStarter)
       Also remember that most ISPs don't accept mail from unrecognized machines anymore.
    Gary
    ~~~~
       Money isn't everything -- but it's a long way ahead of
       what comes next.
             -- Sir Edmond Stockdale

Maybe you are looking for

  • Importing a Project outof memory error

    Hi all, When i am importing a project (xml) file which was a 210Mb size.Getting outofMemoryerror .Is there any limitation ??? Any suggestions? Note: using BI APPS(OBIEE) 7.9.5.2 ODI Project thanks, saichand.v

  • IPad 2 safari won't open and iPad won't switch off IOS 6.0.1

    Hallo everyone, Pleease can anyone help as my iPad 2 is no longer recognised in iTunes.  I cannot open Safari - it immediately returns to the home screen. It will not switch off so that I can reboot it. Aaaargh ! Thanks

  • Upgrading oracle applications doubt

    Hi, I am upgrading oracle applications from 11.5.10.2 to R12.1.1 in linux OEL 5. I have successfully upgraded the db from 9.2.0.6 to 10.2.0.5. And also new R12.1.1 file system is laid. Now following upgrade guide, updated pfile as per R12 requirement

  • WRT54G for computer internet gaming

    I just bought a RC aircraft game that has a multiplayer online game mode. I have to use a Static IP address and have a port range between 61234 and 61241. Simple enough I guess, if you know what you"re doing. Here are the prolbems I am running into.

  • Where do you find Adobe Premiere Elements 13.1?

    I've spent good part of the day trying to obtain assistance from Adobe to obtain version 13.1 and so far, nobody has helped.  So I will try the forums.  I purchased Adobe Premiere Elements 13 and installed it.  Actual version appears to be "13.0 (201