Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member tksforlife's Avatar
    Join Date
    Oct 2012
    Location
    Hawaii
    Posts
    26
    Member #
    33545
    Cant seem to get an email through but I cant find any problems... Help much appreciated!

    PHP Code:
    <?php
    if (isset($_POST['submit'])){

        
    //robot catch
        
    if(!empty($spam)){
            exit;
        }

        
    //create best new line command depending on OS
        
    if (strtoupper(substr(PHP_OS03) == 'WIN')) {
            
    $eol "\r\n";
        } elseif (
    strtoupper(substr(PHP_OS03) == 'MAC')) {
            
    $eol "\r";
        } else {
            
    $eol "\n";
        }

        
    //set variables
        
    $name $_POST['name'];
        
    $email $_POST['email'];
        
    $phone $_POST['phone'];
        
    $subject $_POST['subject'];
        
    $message $_POST['message'];

        
    //email recipient
        
    $artsatheart "Arts at Heart <stajima@hawaii.edu>, ";

        
    //set subject and message
        
    $subject 'Arts at Heart - Email from '.$name.' regarding '.$subject;
        
    $msg =  'Name: ' .$name$eol .'Email Address: ' .$email$eol .'Phone Number: ' .$phone$eol.'Message: ' .$message$eol;

        
    //additional email information for servers
        
    $headers .= 'From: Arts at Heart <email@gmail.com>' $eol;
        
    $headers .= 'Reply-To: ' $name ' <' .$email '>' $eol;
        
    $headers .= 'Return-Path: Arts at Heart <email@gmail.com>' $eol;
        
    $headers .= "Message-ID:<" date('M-d-y') . " support@" $_SERVER['SERVER_NAME'] . ">" $eol;
        
    $headers .= "X-Mailer: PHP v" phpversion() . $eol;

        
    //mail email
        
    mail($artsatheart,$subject,$msg,$headers);
        
    header'Location: http://www.facebook.com/' ) ;
        exit();

    }else{
        
    header'Location: http://www.cnet.com/' ) ;
        exit();
    }
    ?>
    HTML Code:
    <div id="contactForm">
                <form method="post" action="submit.php">
                    <fieldset>
                        <div id="contactLeft">
                            <label for="name">Name</label>
                            <input id="contactInput" type="text" name="name" autofocus="autofocus" placeholder="Full Name" required="required">
    
                            <label for="email">E-mail</label>
                            <input id="contactInput" type="email" name="email" placeholder="name@domain.com" required="required">
    
                            <label for="phone">Phone</label>
                            <input id="contactInput" type="tel" name="phone" placeholder="ex. (555) 555-5555">
    
                            <label for="website">Subject</label>
                            <input id="contactInput" type="text" name="subject" placeholder="What's on your mind?" required="required">
                        </div>
    
                        <div id="contactRight">
                            <label for="message">Question/Comment</label>
                            <textarea id="message" name="message" placeholder="What's up?" required="required"></textarea>
    
                            <input id="" type="text" name="spam" placeholder="Spam Catcher">
    
                            <input id="submitButton" type="submit" name="submit"/>
                        </div>
                    </fieldset>
                </form>
            </div>

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    Temporarily remove the checking for submit and spam ... just to make sure it's not causing the problem.

    Put your mail() function in an "if" statement. That will force PHP to execute it fully before continuing on. Perhaps it's timing out?

    //mail email
    if(mail($artsatheart,$subject,$msg,$headers)){
    // wait for completion of if statement
    }
    header( 'Location: http://www.facebook.com/' ) ;
    exit();

    EDIT:
    I don't think you can do this:
    $artsatheart = "Arts at Heart <stajima@hawaii.edu>, ";

    Do this instead:
    $artsatheart = "stajima@hawaii.edu";



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:52 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com