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 9 of 9

Thread: Php mail

  1. #1
    New Coder
    Join Date
    Aug 2009
    Posts
    84
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Php mail

    Hi i have this php mail script and it says message sent successfuly but i never recieve the message.
    any help apreciated.

    i know my email address needs to go where "you@someone.com" is so thats not the problem.
    code:

    <?php
    $to = "you@someone.com";
    $subject = "Hi!";
    $body = "Hi,\n\nHow are you?";
    if (mail($to, $subject, $body)) {
    echo("<p>Message successfully sent!</p>");
    } else {
    echo("<p>Message delivery failed...</p>");
    }
    ?>

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    could be a few things.

    a) have you checked your spam folder?
    b) is apache/linux correctly configured with with sendmail?

    c) try adding headers:

    PHP Code:
    <?php
    $to      
    'nobody@example.com';
    $subject 'the subject';
    $message 'hello';
    $headers 'From: webmaster@example.com' "\r\n" .
        
    'Reply-To: webmaster@example.com' "\r\n" .
        
    'X-Mailer: PHP/' phpversion();

    mail($to$subject$message$headers);
    ?>

  • #3
    New Coder
    Join Date
    Aug 2009
    Posts
    84
    Thanks
    10
    Thanked 0 Times in 0 Posts
    headers doesn't work.
    how can i check if it is configured correctly.
    thanks

  • #4
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    what do you mean headers don't work? in what way do they not work??

    yes, normally a good test would be to use the mail function which you are trying now.

    use the default script that I posted ( right from the manual ), configure it with your email address and test it. post back if theres an error.

  • #5
    New Coder
    Join Date
    Aug 2009
    Posts
    84
    Thanks
    10
    Thanked 0 Times in 0 Posts
    i used the script you posted but still no luck. it doesn't say theres any errors i just don't recieve the email

  • #6
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    did you get an error? and did you check your spam folder?

  • #7
    New Coder
    Join Date
    Aug 2009
    Posts
    84
    Thanks
    10
    Thanked 0 Times in 0 Posts
    no errors and yes i checked my spam folder.

  • #8
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    hmm, not sure what I can do for you then, you can try and call your host and have them look into this. also it may be that your host/server ip has been black listed. but as for the php itself. it should work as is.

  • Users who have thanked angst for this post:

    alcool9999 (09-10-2009)

  • #9
    New Coder
    Join Date
    Aug 2009
    Posts
    84
    Thanks
    10
    Thanked 0 Times in 0 Posts
    ok thanks for your help


  •  

    Posting Permissions

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