www.webdeveloper.com
Results 1 to 3 of 3

Thread: PhpMailer Redirect Error Message

Threaded View

  1. #1
    Join Date
    Dec 2008
    Posts
    135

    PhpMailer Redirect Error Message

    I am using the below code for a webform but getting the below error messages. Please help. Thanks.

    Error 1
    Code:
    Warning: Cannot modify header information - headers already sent by (output started at class.phpmailer.php:1370) in processform.php on line 63
    Error 2 - With this error message the attachment is not required but can upload max 4 files.
    Code:
    Could not access file: Array Could not access file: Array Could not access file: Array Could not access file: Array
    PHP Code:
    <?php
        $errors 
    = array();
        if (
    'POST' === $_SERVER['REQUEST_METHOD'])
        {
            
    $name           sanitize($_POST['name']);
            
    $email                 sanitize($_POST['email']);

            if (empty(
    $name))
            {
                
    $errors['name'] = "Please provide name.";
            }
     
            if (!
    filter_var($emailFILTER_VALIDATE_EMAIL))
            {
                
    $errors['email'] = "Please provide a valid email address.";
            }
               
    // If there are no errors let's process the payment
            
    if (count($errors) === 0)
            {
                
        require(
    "class.phpmailer.php");
        
        
    $mail = new PHPMailer();
        
    $mail->From     $email;
        
    $mail->AddAddress("myfriend@example.net");

        
    $mail->Subject  "Test";
        
    $mail->Body     "some message here.";
        
    $mail->WordWrap 50;

        
    $mail->AddAttachment($_FILES['file']['tmp_name']);
        
    $mail->AddAttachment($_FILES['file']['tmp_name']);
        
    $mail->AddAttachment($_FILES['file']['tmp_name']);
        
    $mail->AddAttachment($_FILES['file']['tmp_name']);

        
    $mail->Send();
        
        exit(
    header("Location: thankyou.php"));
                }    }

    function 
    sanitize($value)
        {
            return 
    trim(strip_tags($value));
        }
    ?>
    Last edited by phpnewbie08; 03-10-2013 at 01:43 AM.

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