Closed Thread
Results 1 to 2 of 2
Like Tree3Likes
  • 2 Post By Pastor.Shaun
  • 1 Post By stpvoice

Thread: PHP Contact Form Not Sending Email

  1. #1
    Pastor.Shaun is offline x10Hosting Member Pastor.Shaun is an unknown quantity at this point
    Join Date
    May 2011
    Posts
    1

    PHP Contact Form Not Sending Email

    I have created a simple contact form on my new site and it is not sending the email.

    I am not new to PHP or server side email scripts, I have created dozens of them. I also have a very strong technical background.

    I have searched the forums, FAQ and found no answers. I have also created several test scripts and used some of the scripts found in the Forums... none of them work.

    Interesting is that I can telnet to the mail server on port 25 and webmail works from my cPanel, all of which are on STARKA.

    Have I missed something in my cPanel setup to get the script to work?

    The last test script I used is below (which was taken from the forums).

    Thank you in advance,

    Pastor Shaun
    Rahab Ministries

    ================================================== ======

    <?php
    function spamcheck($field)
    {
    //filter_var() sanitizes the e-mail
    //address using FILTER_SANITIZE_EMAIL
    $field=filter_var($field, FILTER_SANITIZE_EMAIL);

    //filter_var() validates the e-mail
    //address using FILTER_VALIDATE_EMAIL
    if(filter_var($field, FILTER_VALIDATE_EMAIL))
    {
    return TRUE;
    }
    else
    {
    return FALSE;
    }
    }

    if (isset($_REQUEST['email']))
    {//if "email" is filled out, proceed

    //check if the email address is invalid
    $mailcheck = spamcheck($_REQUEST['email']);
    if ($mailcheck==FALSE)
    {
    echo "Try Again";
    }
    else
    {//send email
    $email = $_REQUEST['email'] ;
    $subject = $_REQUEST['subject'] ;
    $message = $_REQUEST['message'] ;
    mail("contact@rahabministries.x10.mx", "Subject: $subject",
    $message, "From: $email" );
    echo "Thank you, your email has been sent.";
    }
    }
    else
    {//if "email" is not filled out, display the form
    echo "<div style='padding:5px;'><form method='post' action='test.php'>
    Email: <input name='email' type='text' /><br />
    Subject: <input name='subject' type='text' /><br />
    Message:<br />
    <textarea name='message' rows='15' cols='40'>
    </textarea><br />
    <input type='submit' value='Send' />
    </form></div>";
    }
    ?>

    ---------- Post added at 02:18 PM ---------- Previous post was at 07:53 AM ----------

    I created a work around to log into the SMTP server. While the form works the issue is not resolved as I would like to understand why the PHP mail() function does not work.
    dinomirt96 and verlmirt17 like this.

  2. #2
    stpvoice's Avatar
    stpvoice is offline Community Support Rep stpvoice has a brilliant futurestpvoice has a brilliant futurestpvoice has a brilliant future
    Join Date
    Dec 2008
    Location
    United Kingdom
    Posts
    5,939

    Re: PHP Contact Form Not Sending Email

    Hello,

    It appears that php mail may be not working due to ongoing maintenance. I have reported the issue, but have been advised to wait until maintenance is completed. Update threads can be found here: http://x10hosting.com/forums/news-announcements/
    If the issue persists once maintenance is complete, please let us know then.
    Also, what is your cPanel username? I can't see an account linked to the forum account you posted from.

    Thanks.
    karimirt47 likes this.


Closed Thread

Similar Threads

  1. Sending email contact form from flash using PHP
    By fllrfth in forum Programming Help
    Replies: 3
    Last Post: 09-12-2010, 11:31 AM
  2. sending email from a form on my site?
    By pmcmurrough16 in forum Free Hosting
    Replies: 2
    Last Post: 06-23-2010, 05:09 PM
  3. Trouble with sending Email from Contact form.
    By weathersnap in forum Free Hosting
    Replies: 2
    Last Post: 06-12-2010, 04:09 PM
  4. Contact.php Email Form Not Emailing
    By bigjohnsta in forum Free Hosting
    Replies: 5
    Last Post: 05-12-2009, 06:14 AM
  5. Simple PHP Email Sending Form
    By dquigley in forum Programming Help
    Replies: 10
    Last Post: 12-13-2008, 02:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers