Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New Coder
    Join Date
    Aug 2009
    Posts
    51
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Email script not functioning properly?

    Basically I have introduced an email script into my system and it is not working when trying to run with WAMP. I have changed my email address and tried to use it immediately without editing anything else or linking to the pages using iframes etc. When I try to send the email I get the following error code.



    here is the link to the resource script I used (I used the bottom one).

    http://www.html-form-guide.com/conta...tact-form.html

    I'm wondering if this is an error with the code I have or is it the fact I'm testing it with wamp?

  • #2
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,387
    Thanks
    8
    Thanked 1,077 Times in 1,068 Posts
    Those error (deprecation) is telling you that the PHP functions used
    will be (or is already) eliminated in the latest version of PHP.

    http://takien.com/513/how-to-fix-fun...-php-5-3-0.php

    The split function:
    http://php.net/manual/en/function.split.php

    split is replaced by using "explode" ...
    http://www.php.net/manual/en/function.explode.php

    You may just find it easier to locate a more current email script,
    or go into the one you have and update the scripting.


    .

  • Users who have thanked mlseim for this post:

    snowdude2004 (02-17-2012)

  • #3
    New Coder
    Join Date
    Aug 2009
    Posts
    51
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Cheers, I'll have a look into it now, If I can get it to work I'll be sure to thank your post :3

  • #4
    New Coder
    Join Date
    Aug 2009
    Posts
    51
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    Those error (deprecation) is telling you that the PHP functions used
    will be (or is already) eliminated in the latest version of PHP.

    http://takien.com/513/how-to-fix-fun...-php-5-3-0.php

    The split function:
    http://php.net/manual/en/function.split.php

    split is replaced by using "explode" ...
    http://www.php.net/manual/en/function.explode.php

    You may just find it easier to locate a more current email script,
    or go into the one you have and update the scripting.


    .
    Just looked at the page, the script was only posted a month ago, so I presume its predated for WAMP but would work normally outside of wamp...eerrgghh I hate doing PHP and not having access to the server from home.

  • #5
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,387
    Thanks
    8
    Thanked 1,077 Times in 1,068 Posts
    It wouldn't hurt to use the script but make changes to it.
    Outside of WAMP, in the shared webhost world, the same thing will happen eventually.

    My webhost is at: PHP 5.3.8

    I know for sure that I was getting the "split deprecation" errors .. until I went
    through some scripts and made changes. It keeps the PHP programmers in business.

    EDIT:
    Also, you'll get warnings and notices about using any date or time functions
    unless you define your timezone, in either your PHP config file, or in the scripts ...

    For myself, I pick the US Central Timezone ...
    date_default_timezone_set('America/Chicago');

    No big deal, but something to deal with.


    .
    Last edited by mlseim; 02-17-2012 at 02:32 PM.

  • #6
    New Coder
    Join Date
    Aug 2009
    Posts
    51
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Just had a quick look at depreciation code and saw the change over. So had a quick attempt. This was the original code:

    Code:
    original:
    
            return eregi("^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$", $email);
        }
    Which I replaced with:

    Code:
    New:
    
    return (!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i",$email));
        }
    but by doing this I have now come up with the error below. I presume this code is going to need completely redoing in many sections and i'll be better off making a much more basic mail system with three seperate fields with a mailto function and declare the variables for name, email, header etc?

    error:
    Please provide a valid email address

  • #7
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,387
    Thanks
    8
    Thanked 1,077 Times in 1,068 Posts
    Seeing this example online ...

    // Email mask
    if(preg_match("/^[a-zA-Z]\w+(\.\w+)*\@\w+(\.[0-9a-zA-Z]+)*\.[a-zA-Z]{2,4}$/", $_POST["email"]) === 0)
    $errEmail = '<p class="errText">Email must comply with this mask: chars(.chars)@chars(.chars).chars(2-4)</p>';

    I notice you're doing "not" ...
    !preg_match

    Is is supposed to be "not"?


    .

  • #8
    New Coder
    Join Date
    Aug 2009
    Posts
    51
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    Seeing this example online ...

    // Email mask
    if(preg_match("/^[a-zA-Z]\w+(\.\w+)*\@\w+(\.[0-9a-zA-Z]+)*\.[a-zA-Z]{2,4}$/", $_POST["email"]) === 0)
    $errEmail = '<p class="errText">Email must comply with this mask: chars(.chars)@chars(.chars).chars(2-4)</p>';

    I notice you're doing "not" ...
    !preg_match

    Is is supposed to be "not"?


    .
    *slaps self on forehead and goes red* DOH!
    Thank you xD

  • #9
    New Coder
    Join Date
    Aug 2009
    Posts
    51
    Thanks
    10
    Thanked 0 Times in 0 Posts
    have changed split to explode and also addressed the eregi issue and now when clicking submit on the form neither errors pop up however mail is now not sent what so ever...what could be wrong now eerrgghh.

    Edit:
    Here is the completed code I have:
    http://www.mediafire.com/?pftg2pk8azuop1n

  • #10
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    Make sure error reporting is on(see stickies), comment out the redirect so you can see if there is an error, and var_dump() the return from $formproc->ProcessForm() inside of your contact form file so you can see if the mail was sent at all.

  • #11
    New Coder
    Join Date
    Aug 2009
    Posts
    51
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Inigoesdr View Post
    Make sure error reporting is on(see stickies), comment out the redirect so you can see if there is an error, and var_dump() the return from $formproc->ProcessForm() inside of your contact form file so you can see if the mail was sent at all.
    My PHP is very limited so I don't quite understand what I need to do, anyway doing what you said about error reporting I put in this code at the top of every php page and it did nothing:

    Code:
    ini_set('display_errors',1);
    ini_set('display_startup_errors',1);
    error_reporting (E_ALL);
    and on the contact form page I added this at the bottom of the error reporting:

    Code:
    ob_end_flush();
    By adding this bit I then received this error when submitting the form


  • #12
    New Coder
    Join Date
    Aug 2009
    Posts
    51
    Thanks
    10
    Thanked 0 Times in 0 Posts
    right I deleted the obendflush and then managed to implement var dump which can be seen below:


    Code:
    if(isset($_POST['submitted']))
    {
       if($formproc->ProcessForm())
       var_dump($formproc);
       {
            $formproc->RedirectToURL("thank-you.php");
       }
    }
    By putting this in it is now saying the message has been submitted but no mail is being received on the email address I specified

  • #13
    New Coder
    Join Date
    Aug 2009
    Posts
    51
    Thanks
    10
    Thanked 0 Times in 0 Posts
    also tried putting var dump at the end of the form but above the last bit of javascript. (is it not working because wamp wont recognise JS?)

    when putting vardump at the end I get the code below the input:

    Code:
    object(FGContactForm)[1]
      public 'receipients' => 
        array
          empty
      public 'errors' => 
        array
          empty
      public 'error_message' => null
      public 'name' => null
      public 'email' => null
      public 'message' => null
      public 'from_address' => null
      public 'form_random_key' => string 'CnRrspl1FyEylUj' (length=15)
      public 'conditional_field' => string '' (length=0)
      public 'arr_conditional_receipients' => 
        array
          empty
      public 'fileupload_fields' => 
        array
          empty
      public 'captcha_handler' => 
        object(FGSimpleCaptcha)[3]
          public 'error_str' => null
          public 'captcha_varname' => string 'scaptcha' (length=8)
          public 'uniquekey' => string 'KHJhsjsy65HGbsmnd' (length=17)
      public 'mailer' => 
        object(PHPMailer)[2]
          public 'Priority' => int 3
          public 'CharSet' => string 'utf-8' (length=5)
          public 'ContentType' => string 'text/plain' (length=10)
          public 'Encoding' => string '8bit' (length=4)
          public 'ErrorInfo' => string '' (length=0)
          public 'From' => string 'root@localhost' (length=14)
          public 'FromName' => string 'Root User' (length=9)
          public 'Sender' => string '' (length=0)
          public 'Subject' => string '' (length=0)
          public 'Body' => string '' (length=0)
          public 'AltBody' => string '' (length=0)
          public 'WordWrap' => int 0
          public 'Mailer' => string 'mail' (length=4)
          public 'Sendmail' => string '/usr/sbin/sendmail' (length=18)
          public 'PluginDir' => string '' (length=0)
          public 'Version' => string '2.0.4' (length=5)
          public 'ConfirmReadingTo' => string '' (length=0)
          public 'Hostname' => string '' (length=0)
          public 'MessageID' => string '' (length=0)
          public 'Host' => string 'localhost' (length=9)
          public 'Port' => int 25
          public 'Helo' => string '' (length=0)
          public 'SMTPSecure' => string '' (length=0)
          public 'SMTPAuth' => boolean false
          public 'Username' => string '' (length=0)
          public 'Password' => string '' (length=0)
          public 'Timeout' => int 10
          public 'SMTPDebug' => boolean false
          public 'SMTPKeepAlive' => boolean false
          public 'SingleTo' => boolean false
          public 'smtp' => null
          public 'to' => 
            array
              0 => 
                array
                  ...
          public 'cc' => 
            array
              empty
          public 'bcc' => 
            array
              empty
          public 'ReplyTo' => 
            array
              empty
          public 'attachment' => 
            array
              empty
          public 'CustomHeader' => 
            array
              empty
          public 'message_type' => string '' (length=0)
          public 'boundary' => 
            array
              empty
          public 'language' => 
            array
              empty
          public 'error_count' => int 0
          public 'LE' => string '
    ' (length=1)
          public 'sign_cert_file' => string '' (length=0)
          public 'sign_key_file' => string '' (length=0)
          public 'sign_key_pass' => string '' (length=0)
    and when I've submitted information it then changes to:

    Code:
    object(FGContactForm)[1]
      public 'receipients' => 
        array
          empty
      public 'errors' => 
        array
          0 => string 'Failed sending email!' (length=21)
      public 'error_message' => null
      public 'name' => string 'alex' (length=4)
      public 'email' => string 'snow_dude2004@yahoo.co.uk' (length=25)
      public 'message' => string 'message at 4 51' (length=15)
      public 'from_address' => null
      public 'form_random_key' => string 'CnRrspl1FyEylUj' (length=15)
      public 'conditional_field' => string '' (length=0)
      public 'arr_conditional_receipients' => 
        array
          empty
      public 'fileupload_fields' => 
        array
          empty
      public 'captcha_handler' => 
        object(FGSimpleCaptcha)[3]
          public 'error_str' => null
          public 'captcha_varname' => string 'scaptcha' (length=8)
          public 'uniquekey' => string 'KHJhsjsy65HGbsmnd' (length=17)
      public 'mailer' => 
        object(PHPMailer)[2]
          public 'Priority' => int 3
          public 'CharSet' => string 'utf-8' (length=5)
          public 'ContentType' => string 'multipart/alternative' (length=21)
          public 'Encoding' => string '8bit' (length=4)
          public 'ErrorInfo' => string 'Could not instantiate mail function.' (length=36)
          public 'From' => string 'nobody@localhost' (length=16)
          public 'FromName' => string 'alex' (length=4)
          public 'Sender' => string '' (length=0)
          public 'Subject' => string 'Contact form submission from alex' (length=33)
          public 'Body' => string '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html><head><title></title><meta http-equiv=Content-Type content="text/html; charset=utf-8">
    <style>body,.label,.value { font-family:Arial,Verdana; } .label {font-weight:bold; margin-top:5px; font-size:1em; color:#333;} .value {margin-bottom:15px;font-size:0.8em;padding-left:5px;} </style>
    </head><body>Submission from 'contact us' form:<p><div class='label'>Name :</div><div class='value'>alex </div>
    <div class='label'>Email :</div><div class='va'... (length=803)
          public 'AltBody' => string 'Submission from 'contact us' form:Name :alex 
    Email :snow_dude2004@yahoo.co.uk 
    Message :message at 4 51 
    Submit :Submit 
    IP address of the submitter:127.0.0.1' (length=159)
          public 'WordWrap' => int 0
          public 'Mailer' => string 'mail' (length=4)
          public 'Sendmail' => string '/usr/sbin/sendmail' (length=18)
          public 'PluginDir' => string '' (length=0)
          public 'Version' => string '2.0.4' (length=5)
          public 'ConfirmReadingTo' => string '' (length=0)
          public 'Hostname' => string '' (length=0)
          public 'MessageID' => string '' (length=0)
          public 'Host' => string 'localhost' (length=9)
          public 'Port' => int 25
          public 'Helo' => string '' (length=0)
          public 'SMTPSecure' => string '' (length=0)
          public 'SMTPAuth' => boolean false
          public 'Username' => string '' (length=0)
          public 'Password' => string '' (length=0)
          public 'Timeout' => int 10
          public 'SMTPDebug' => boolean false
          public 'SMTPKeepAlive' => boolean false
          public 'SingleTo' => boolean false
          public 'smtp' => null
          public 'to' => 
            array
              0 => 
                array
                  ...
          public 'cc' => 
            array
              empty
          public 'bcc' => 
            array
              empty
          public 'ReplyTo' => 
            array
              0 => 
                array
                  ...
          public 'attachment' => 
            array
              empty
          public 'CustomHeader' => 
            array
              empty
          public 'message_type' => string 'alt' (length=3)
          public 'boundary' => 
            array
              1 => string 'b1_c85f9702d8b42058c4995a0b5f985b08' (length=35)
              2 => string 'b2_c85f9702d8b42058c4995a0b5f985b08' (length=35)
          public 'language' => 
            array
              'mailer_not_supported' => string ' mailer is not supported.' (length=25)
              'provide_address' => string 'You must provide at least one  mailer is not supported.' (length=55)
              'execute' => string 'Could not execute: ' (length=19)
              'instantiate' => string 'Could not instantiate mail function.' (length=36)
              'authenticate' => string 'SMTP Error: Could not authenticate.' (length=35)
              'from_failed' => string 'The following From address failed: ' (length=35)
              'data_not_accepted' => string 'SMTP Error: Data not accepted.' (length=30)
              'recipients_failed' => string 'SMTP Error: The following SMTP Error: Data not accepted.' (length=56)
              'connect_host' => string 'SMTP Error: Could not connect to SMTP host.' (length=43)
              'file_access' => string 'Could not access file: ' (length=23)
              'file_open' => string 'File Error: Could not open file: ' (length=33)
              'encoding' => string 'Unknown encoding: ' (length=18)
              'signing' => string 'Signing Error: ' (length=15)
          public 'error_count' => int 1
          public 'LE' => string '
    ' (length=1)
          public 'sign_cert_file' => string '' (length=0)
          public 'sign_key_file' => string '' (length=0)
          public 'sign_key_pass' => string '' (length=0)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •