Mailform..Help

Discussion in 'PHP' started by TatiAnA, Jun 9, 2007.

  1. #1
    To the PHP gurus out there, i know someone can help me out..
    I currently have a php mailform on my site but when you fill out the form, the information is not reaching the email address specified below. Here is the code and i hope someone can help me straighten out this problem.

    Also, if i change the email address to an email address hosted in a different company, it works. Is there something that needs to be configured on the mail server to make these php mailform work?


    <?php

    $msg = "Name:\t$_POST[name]\n";
    $msg .= "Position:\t$_POST[position]\n";
    $msg .= "Email :\t$_POST
     
    TatiAnA, Jun 9, 2007 IP
  2. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #2
    your headers are wrong. iirc, there's no title header. here's how i would do it.
    also, you need to quote your array keys.

    
    <?php
    $to = "tatainaemail@mywebsite.com";
    $subject = "webmail from website";
    
    $msg = "Name:\t".$_POST['name']."\n";
    $msg .= "Position:\t".$_POST['position']."\n";
    $msg .= "Email :\t".$_POST['emai'l]."\n\n";
    
    $headers = "From: me@mywebsite.com\r\nX-Mailer: php";
    if (mail($to, $subject, $msg, $headers)) {
      echo("sent");
     } else {
      echo("failed");
     }
    ?>
    
    PHP:
     
    ansi, Jun 9, 2007 IP
  3. TatiAnA

    TatiAnA Active Member

    Messages:
    1,103
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    78
    #3
    Thanks ansi. I made the corrections...but still not working. What confuses me is that....why is it working on my other hosting account.....and not on the other one?
     
    TatiAnA, Jun 9, 2007 IP
  4. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #4
    could be the configuration of the mail server i'm not sure. might want to contact the server administrator and find out. if anything i can host you for a small price
     
    ansi, Jun 9, 2007 IP
  5. TatiAnA

    TatiAnA Active Member

    Messages:
    1,103
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    78
    #5
    sure. i'd love to ansi. i just wana get my mailform working...PM me the price asap
     
    TatiAnA, Jun 9, 2007 IP
  6. TatiAnA

    TatiAnA Active Member

    Messages:
    1,103
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    78
    #6
    also if you could offer a free trial would be great
     
    TatiAnA, Jun 10, 2007 IP