help with mail()

Discussion in 'PHP' started by arpit13, Dec 22, 2010.

  1. #1
    hi,

    i am using mail() function like this:
    
    $headers = "From: {$u}";
    $t="$_POST[email]";
    $s="Welcome To {$_SERVER[HTTP_HOST]}";
    $m="Welcome\n\n\n\nYou Are Now a Member of  $_SERVER[HTTP_HOST] and we are glad that you chose to join us.\n\nBefore Uploading Your First Pic You Must Confirm Your Email Id By Using This Link:\nhttp://$_SERVER[HTTP_HOST]/verify.php?u=base64_encode($_POST[uname])\n\n\nYou Will Be Redirected to our homepage on success.\n\n\n\n\nThank You.";
    mail($t,$s,$m,$headers) or die("mail sending error");
    
    PHP:
    $u is the email id of me here.

    i am not getting an error bu it is not sending a email to $_POST.

    can u help in fixing it?
     
    arpit13, Dec 22, 2010 IP
  2. tvoodoo

    tvoodoo Active Member

    Messages:
    239
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #2
    do all $_POST[] as $_POST[''] , meaning that for the variable $t you assign the value as :
    $t = $_POST['email'];
    $s = 'Welcome to '.$_SERVER['HTTP_HOST'];
    and so on.
     
    tvoodoo, Dec 22, 2010 IP
  3. arpit13

    arpit13 Well-Known Member

    Messages:
    294
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    128
    Digital Goods:
    1
    #3
    i did it but its still not working. :(
     
    arpit13, Dec 22, 2010 IP
  4. tvoodoo

    tvoodoo Active Member

    Messages:
    239
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #4
    I honestly don't think you did.Try this :
    
    <?php
        $headers = "From: {$u}";
        $t = $_POST['email'];
        $s = "Welcome To ".$_SERVER['HTTP_HOST'];
        $m = "Welcome\n\n\n\nYou Are Now a Member of ".$_SERVER['HTTP_HOST']." and we are glad that you chose to join us.\n\nBefore Uploading Your First Pic You Must Confirm Your Email Id By Using This Link:\nhttp://".$_SERVER['HTTP_HOST']."/verify.php?u=".base64_encode($_POST['uname'])."\n\n\nYou Will Be Redirected to our homepage on success.\n\n\n\n\nThank You.";
        mail($t,$s,$m,$headers) or die("mail sending error");
    ?>
    
    PHP:
     
    tvoodoo, Dec 22, 2010 IP
  5. arpit13

    arpit13 Well-Known Member

    Messages:
    294
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    128
    Digital Goods:
    1
    #5
    i did the same.it didn't worked.so i started experimenting with the code.
    strangely making $t="from: ".$u; worked. i just made From to from .
     
    arpit13, Dec 22, 2010 IP
  6. tvoodoo

    tvoodoo Active Member

    Messages:
    239
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #6
    Well , at least it works now :)
     
    tvoodoo, Dec 22, 2010 IP
  7. natsu90

    natsu90 Greenhorn

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #7
    maybe your server had spam filter.

    EDIT: nvm.
     
    natsu90, Dec 22, 2010 IP