+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: is php mail() function working?

  1. #1
    web.houstontoh88 is offline x10Hosting Member web.houstontoh88 is an unknown quantity at this point
    Join Date
    Nov 2010
    Posts
    6

    Question is php mail() function working?

    is php mail() function working?
    i have a registration script that send applicants an email when registering. Was testing by sending to my personal email but the mail doesnt get sent. my script is absolutely as it returns true when mail() is invoked.
    Last edited by web.houstontoh88; 04-23-2011 at 01:45 AM.

  2. #2
    mrnutt is offline x10Hosting Member mrnutt is an unknown quantity at this point
    Join Date
    Nov 2009
    Location
    Australia
    Posts
    9

    Smile Re: is php mail() function working?

    Yes as far as i can tell. i use the mail() function on my basic contact form at My Website .Hope this helps.

  3. #3
    web.houstontoh88 is offline x10Hosting Member web.houstontoh88 is an unknown quantity at this point
    Join Date
    Nov 2010
    Posts
    6

    Re: is php mail() function working?

    Quote Originally Posted by mrnutt View Post
    Yes as far as i can tell. i use the mail() function on my basic contact form at My Website .Hope this helps.
    do ur site send email to me when i input my email?

  4. #4
    mrnutt is offline x10Hosting Member mrnutt is an unknown quantity at this point
    Join Date
    Nov 2009
    Location
    Australia
    Posts
    9

    Re: is php mail() function working?

    no it is sent to send to me.

    Here is a basic working contact form in php using mail()

    Code:
    <?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("YOUREMAIL", "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='contact.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>";
      }
    ?>
    save as contact.php
    Last edited by mrnutt; 04-23-2011 at 03:17 AM. Reason: Show code

  5. #5
    web.houstontoh88 is offline x10Hosting Member web.houstontoh88 is an unknown quantity at this point
    Join Date
    Nov 2010
    Posts
    6

    Re: is php mail() function working?

    so did u recieved an email where its from toh.houston@gmail.com?

  6. #6
    mrnutt is offline x10Hosting Member mrnutt is an unknown quantity at this point
    Join Date
    Nov 2009
    Location
    Australia
    Posts
    9

    Re: is php mail() function working?

    yes 2

  7. #7
    web.houstontoh88 is offline x10Hosting Member web.houstontoh88 is an unknown quantity at this point
    Join Date
    Nov 2010
    Posts
    6

    Re: is php mail() function working?

    Quote Originally Posted by mrnutt View Post
    yes 2
    thanks i will try again!

  8. #8
    vv.bbcc19's Avatar
    vv.bbcc19 is offline Community Advocate vv.bbcc19 is just really nice
    Join Date
    Jun 2010
    Location
    India
    Posts
    1,505

    Re: is php mail() function working?

    Quote Originally Posted by web.houstontoh88 View Post
    is php mail() function working?
    i have a registration script that send applicants an email when registering. Was testing by sending to my personal email but the mail doesnt get sent. my script is absolutely as it returns true when mail() is invoked.
    The best tutorial (I think) is put here.
    This worked for me.I put that on my sites too.
    http://www.w3schools.com/PHP/php_mail.asp

    Regs,
    VVBB
    BCV | Community Support Representative
    █ x10Hosting - Giving Away Hosting Since 2004
    Premium Hosting | VPS Services

  9. #9
    ritimao50 is offline x10Hosting Member ritimao50 is an unknown quantity at this point
    Join Date
    Oct 2010
    Posts
    5

    Re: is php mail() function working?

    do i have to set up anything to use the email provided by x10hosting in this function ?

  10. #10
    bidzey75's Avatar
    bidzey75 is offline x10Hosting Member bidzey75 is an unknown quantity at this point
    Join Date
    Apr 2011
    Posts
    51

    Re: is php mail() function working?

    Quote Originally Posted by mrnutt View Post
    no it is sent to send to me.
    mail("YOUREMAIL", "Subject: $subject", $message, "From: $email" );
    [/CODE]save as contact.php
    is this literally the code, because "YOUREMAIL" is not defined anywhere. Perhaps your just hiding the email for posting purposes?

    Also if you use $_REQUEST you have no guarantee that the data came from the post data, which leads to security holes in your script. Use $_POST to grantee that's not the problem.

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. is php mail() function working?
    By web.houstontoh88 in forum Free Hosting
    Replies: 0
    Last Post: 04-23-2011, 01:40 AM
  2. PHP Mail function not working.Please check the mail log
    By vv.bbcc19 in forum Free Hosting
    Replies: 0
    Last Post: 01-15-2011, 12:08 AM
  3. Replies: 4
    Last Post: 10-16-2010, 02:01 AM
  4. Is mail() php function working
    By unodot in forum Free Hosting
    Replies: 1
    Last Post: 04-14-2010, 10:35 PM
  5. php mail function not working
    By aenman in forum Free Hosting
    Replies: 1
    Last Post: 10-26-2007, 11:16 AM

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