Jump to content

logonutility

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by logonutility

  1. I am trying to integrate php mail script on my website Logon Utility but getting error such as : 

     

     <?php
    require_once "recaptchalib.php";

    // your secret key
    $secret = "xxxxxxxxxxxxxx";
     
    // empty response
    $response = null;
     
    // check secret key
    $reCaptcha = new ReCaptcha($secret);

    if ($_POST["g-recaptcha-response"]) {
        $response = $reCaptcha->verifyResponse(
            $_SERVER["REMOTE_ADDR"],
            $_POST["g-recaptcha-response"]
        );
    }


    if ($response != null && $response->success) {
    require_once "Mail.php";

    $pcount=0;
    $gcount=0;
     $file="";
        
     $from=$_POST['email'];
        
     $from2='info@yourdomain.com';
     $name=$_REQUEST['name'];

     $from = "".$name." <".$_POST['email'].">";

     $to = "info@yourdomain.com";

     $subject = "Mail from Logon Utility";

    while (list($key,$val)=each($_POST))
            {
            if($key!='submit' && $key!='g-recaptcha-response')
            {
            $pstr = $pstr."$key : $val \n ";
            ++$pcount;
            }
            }
            while (list($key,$val)=each($_GET))
            {
            if($key!='submit' && $key!='g-recaptcha-response')
            {
            $gstr = $gstr."$key : $val \n ";
            ++$gcount;
            }
            }

     if ($pcount > $gcount)
            {
            $message_body=$pstr;

            }
    else
            {
            $message_body=$gstr;


            }

     
     
    $host = "ssl://secure.emailsrvr.com";
     $port = "465";
     $username = "info@yourdomain.com";
     $password = "xxxxxxx";    
     
     $headers = array ('From' => $from,
       'To' => $to,
       'Subject' => $subject);

     $headers2 = array ('From' =>$from2 ,
       'To' => $from,
       'Subject' => $subject);

     $smtp = Mail::factory('smtp',
       array ('host' => $host,
         'port' => $port,
         'auth' => true,
         'username' => $username,
         'password' => $password));
     
     $mail = $smtp->send($to, $headers, $message_body);
     
     if (PEAR::isError($mail)) {
       echo("<p>" . $mail->getMessage() . "</p>");
      } else {
       //echo("<p>Message successfully sent!</p>");
          header( "Location: thankyou.html"); 
      }
    }
    else {
        if(isset($_SERVER['HTTP_REFERER'])) {
        $ref= $_SERVER['HTTP_REFERER'];
    }
        header("Location: ".$ref.""); 
      }

            
            ?>

×
×
  • 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.