Results 1 to 4 of 4

Thread: Mail() Problem

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2007
    Posts
    35

    Unhappy Mail() Problem

    Hey guys, I'm making a email script for my company and currently I've got it all rigged up and it should be working, but my email just won't work? What I mean by this is that, even thou I make it use Mail(mysettings etc) the email never comes to me. Could one of you check my script? Thanks.

    Code:
    <?php
    // You may edit these to your likings.
    $email                    = "[email protected]";  // Contact email, for visitors
    $emailredirectpage        = "emailsuccess.php";               // The page they will be re-directed too.
    $emailmaxmessage          = "500";                            // Maximum characters for their message.
    
    // Connected to main form, and grab necessary data.
    $emailtitle = $_POST['title']; 
    $emailmsg   = $_POST['message'];
    
    // This is protection against any potential attacks.
    $emailtitle = trim($emailtitle); 
    $emailtitle = preg_replace("/>/","]",$emailtitle); 
    $emailtitle = preg_replace("/</","[",$emailtitle);
    
    // Finally email the client all the information.
    //mail($email,$emailtitle,$emailmsg);
    
    $headers = str_replace(”\r\n”,”\n”,$headers);
    @mail ($email, $emailtitle, $emailmsg, $headers);
    
    // End of script.
    ?>

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Mail() Problem

    What value is in $headers?

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2007
    Posts
    35

    Re: Mail() Problem

    Quote Originally Posted by lintz
    What value is in $headers?
    Well I've removed that now, messy code I had. I've started using..

    Code:
    // Finally email the client all the information.
    if(mail($email_address,$email_title,$email_msg))
    {
       echo "Succesfully Sent mail!";
       //header("Location: $email_redirectpage");
    }
    else
    {
       echo "Something's wrong!";
    }
    And all I get back each time is "Something's wrong!"

  4. #4
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Mail() Problem

    Right, make sure your php.ini file has the correct SMTP.

    phpinfo() will show you this information

Posting Permissions

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



Click Here to Expand Forum to Full Width