Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Junior Member
    Join Date
    Aug 2016
    Posts
    1
    Member #
    54876

    Contact form problems

    Hi,

    I bought a really nice template and can't seem to get the form working. If you fill out the form check out the message it gives. EXPERT DESIGN, WEBSITE DESIGNERS STRONGSVILLE, OHIO 44136

    It directs to a .php and it has comments but I don't like all that and doesn't work on my system and want to make it work so I need different code, I know it should be easier than all the stuff in the comments, here's the code:

    PHP Code:
    // PHP extensions Mail and Net_SMTP must be installed. If they are not already
    // installed, install them by PEAR:
    // > pear install Mail
    // > pear install Net_SMTP
    // SSL must be allowed. On Windows you should uncomment line in php.ini:
    //        extension=php_openssl.dll
    // If you use smtp.gmail.com as smpt host then use:
    //        [url]https://accounts.google.com/DisplayUnlockCaptcha[/url]
    // and allow access for less secure apps:
    //        [url]https://www.google.com/settings/security/lesssecureapps[/url]
    //        
    // =============================================================================
    // NOTES
    // contact.php — is a script for a web servers with php support.
    // Extensions which required for this script are often installed by default.
    // If they are not already installed, the easiest way to do this using PEAR.
    // Learn more about PEAR [url=http://pear.php.net/]PEAR - PHP Extension and Application Repository[/url].
    // Editing the php.ini required only on Windows. On other operating systems this
    // is usually not required. Location of this file depends on settings of web
    // server.
    // Also, your web server should not be denied access to external mail servers.
    // On the majority of paid and on many free hostings (eg OpenShift:
    // [url]https://www.openshift.com/[/url]) all these features are available. 
    // =============================================================================

    require_once "Mail.php";
    // Change this options:
    $username 'user@gmail.com';
    $password 'password';
    $smtpHost 'ssl://smtp.gmail.com';
    $smtpPort '465';
    $to 'user@gmail.com';
    $from 'user@gmail.com';

    $subject 'Contact Form';
    $successMessage 'Message successfully sent!';

    $replyTo $_POST['your-email'];
    $name $_POST['your-name'];
    $body $_POST['your-message'];

    $headers = array(
        
    'From' => $name " <" $from ">",
        
    'Reply-To' => $name " <" $replyTo ">",
        
    'To' => $to,
        
    'Subject' => $subject
    );
    $smtp Mail::factory('smtp', array(
                
    'host' => $smtpHost,
                
    'port' => $smtpPort,
                
    'auth' => true,
                
    'username' => $username,
                
    'password' => $password
            
    ));

    $mail $smtp->send($to$headers$body);

    if (
    PEAR::isError($mail)) {
        echo(
    $mail->getMessage());
    } else {
        echo(
    $successMessage);
    }
    ?> 
    Last edited by Ronald Roe; Aug 04th, 2016 at 07:04 PM.

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:45 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com