Jump to content

Problem with PHPMailer


ChaosKnight

Recommended Posts

Hi, I'm busy implementing PHPMailer in a project, but after hours of hard work, I finally gave up... I got a sample script on one of the php threads here on phpfreaks, but when I try to send the e-mail from the script, the entire contact form include just turns blank, and none of the code gets executed... In the contact include at the top I have the code that gets executed when the sebmit button is pressed, and at the bottom is the HTML form, so I made the form action a blank (action="", I don't know if this is where the phpmailer experiences a problem?). But all the php code is executed, the only problem is the phpmailer code...

 

    require("class.phpmailer.php");

    $mail = new PHPMailer();

    $mail->IsSMTP();
    $mail->Host = "$domainname";
    $mail->SMTPAuth = true;
    $mail->Username = "$username";
    $mail->Password = "$password";

    $mail->From = "$from";
    $mail->FromName = "$fromname";
    $mail->AddAddress($to);
    $mail->AddReplyTo($reply);

    $mail->WordWrap = 50;

    $mail->IsHTML(true);

    $mail->Subject = "$subject";
    $mail->Body = "$body";

    if(!$mail->Send())
    {
      echo "<h3>The message could not be sent...</h3>";
      echo "Mailer Error: " . $mail->ErrorInfo;
      exit;
    }else{
      echo "<h3>The message was sent successfully...</h3>";
    }

 

Not even the error info is return, it just return a complete blank...  :wtf:

 

Any thoughts??

Link to comment
Share on other sites

It threw out the following error messages:

 

Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in f:\wwwroot\domain\PHPMailer\class.phpmailer.php on line 53

Fatal error: Cannot instantiate non-existent class: phpmailer in f:\wwwroot\domain\contact.php on line 20

 

Line 20 in my code is:

$mail = new PHPMailer();

 

So the problem is in the PHPMailer source code? I'm using PHPMailer v5.1

 

Here is PHPMailer v5.1 line 53:

x[$h2].$hex[$h1];
        }
        if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
          $output .= $newline.$escape.$eol; //  soft line break; " =\r\n" is okay
          $newline = '';
          // check if newline first character will be point or not
          if ( $dec == 46 ) {
            $c = '=2E';
          }
        }
        $newline .= $c;
      } // end of for
      $output .= $newline.$eol;
    } // end of while
    return $output;
  }

 

Any ideas?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.