www.webdeveloper.com
Results 1 to 2 of 2

Thread: PHP Form Email?

  1. #1
    Join Date
    Jan 2005
    Posts
    216

    PHP Form Email?

    This is driving me crazy!

    I'm trying to make a simple page send me an email, but when I execute the script, it appears as though the email has sent on the page, but I never get the email. I've checked spam and other filters, but I can't find a reason on the email end... anything on the PHP end that would cause the page to act as though it had sent but actually hadn't?

    Anything you got is great and definately more than I do...

    Code:
        <?php
    if(isset($send))
    {
    $body = "The following entry is for the \"How Well do You Know Woodstock\" ad from:\n\nName:\n".$_POST['name']."\nAddress:\n".$_POST['add1'].", ".$_POST['add2'].",\n ".$_POST['city'].", ".$_POST['state']." ".$_POST['zip']."\nPhone:\n".$_POST['phone']."\n\n\"".$_POST['what'].",\n".$_POST['where']."\"\n";
    
    $from = "FROM: hwdykw@thewoodstockindependent.com"
            ."\r\nX-MSMail-Priority: High" 
            ."\r\nX-Mailer: Microsoft Outlook Express 6.00.2900.2180" 
            ."\r\nX-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180" 
            ."\r\nContent-type: text/html; charset=iso-8859-1\r\n"; 
    
    $to = "c.larson09@gmail.com";
    $subject = "Online HWDYKW Submission";
    
    if(mail($to, $subject, $body, $from))
    {echo "Thank you! Your entry has been sent.";}
    else{
    echo "Oops...";
    }
    }
    else{}
    ?>
    The button works and so does PHP.
    dz_boy

  2. #2
    Join Date
    Aug 2007
    Location
    Washington
    Posts
    219
    I don't see anything off the bat, but have you tried sending an email with a simple subject?

    Another idea would be to remove all those additional headers, except the from and see if that makes a difference.

    On another hand, it seems that the window line breaks "\r\n" could be an issue. Try just "\n".

    From php.net:
    Note: If messages are not received, try using a LF (\n) only. Some poor quality Unix mail transfer agents replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with &#187; RFC 2822.
    http://michaelkrol.com/2005/12/07/ph...ng-on-headers/
    Last edited by bejitto101; 10-30-2008 at 11:04 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles