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

Thread: mail()

  1. #1
    New Coder
    Join Date
    Jul 2003
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question mail()

    just made a simple script that takes variable from form and supposed to mail some text, but it doesn't.
    here it is:

    PHP Code:
    <?
    if (isset($text)){
         
    mail("xxx@xxx.com""mymail""oh, greate! it works! $text");
          echo 
    "$text mailed";
    }else{
    print 
    '**** happens';
    }
    ?>

    help me please to sort it out!

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    PHP Code:
    <?
    $text 
    $_POST['text'];
    if (isset(
    $text)){
         
    mail("xxx@xxx.com""mymail""oh, greate! it works! $text");
          echo 
    "$text mailed";
    }else{
    print 
    '**** happens';
    }
    ?>
    Try this, assuminmg you're getting the $text from a form submitted by POST

  • #3
    New Coder
    Join Date
    Jul 2003
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanx nightfire!
    the problem wasn't with ascrip - my mail server was overloaded.
    thank you!

  • #4
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    bear in mind however, that it is much better to use $_POST['text'] rather than $text

  • #5
    New Coder
    Join Date
    Jul 2003
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Originally posted by missing-score
    bear in mind however, that it is much better to use $_POST['text'] rather than $text
    could u make it clear 4 me?

  • #6
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ahh yes, sorry...

    what i mean is, in nightfire's example:

    PHP Code:
    [b]
    <?
    $text 
    $_POST['text'];
    if (isset(
    $text)){
         
    mail("xxx@xxx.com""mymail""oh, greate! it works! $text");
          echo 
    "$text mailed";
    }else{
    print 
    '**** happens';
    }
    ?>
    [/b]
    he uses $_POST['text']. As you said it was a server problem, i wanted to make it clear than when working with forms, nightfires example is the best way.

  • #7
    New Coder
    Join Date
    Jul 2003
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    $thanx! | $cheers, missing score!


  •  

    Posting Permissions

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