I'm looking for help with phpmailer. I use this script in php 5.5.12.
<?php
header ( 'Content-Type: text/html; charset=utf-8' );
require 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer(true);
$mail->CharSet = 'UTF-8';
$mail->ContentType = 'text/plain';
$mail->isHTML(false);
$master = htmlspecialchars(trim($_POST['master']));
$name = htmlspecialchars(trim($_POST['name']));
$address = htmlspecialchars(trim($_POST['address']));
$telephone = htmlspecialchars(trim($_POST['telephone']));
$question = htmlspecialchars(trim($_POST['question'], " "));
$email = htmlspecialchars(trim($_POST['email']));
$mail->isSMTP();
$mail->Host = '/*here is my host name*/';
$mail->SMTPAuth = true;
$mail->Username = '/*here is my mail*/';
$mail->Password = '/*mypassword*/';
$mail->SMTPSecure = 'auto';
$mail->Port = '25';
$mail->From = 'example@mail.ru';
$mail->FromName = $name;
$mail->addAddress('receiver@gmail.com');
$mail->Subject = 'Subject';
$mail->Body = "$master\n$name\n$address\n$telephone\n$email\n$question";
$dateposted = date("d.m.Y");
if(!$mail->send()) {
echo 'Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent!';
$content = "$master\n
$name\n
$address\n
$telephone\n
$email\n
$question";
$fp = fopen($_SERVER['DOCUMENT_ROOT'] .'/meeting_email/' . "$dateposted" . "_" . $email . '.txt',"wb");
fwrite($fp,$content);
fclose($fp);
}
It works, but when i try to use it on my old server with php 4.3.4. i've got this error:
Fatal error: Cannot instantiate non-existent class: phpmailer in d:\sites\www\record_tech\sender.php on line 5 I red that PHPMailer does not support old php versions and i tryed to use PHPMailer 2.3.
I've replaced "require" to "require 'phpmailer1/class.phpmailer.php';"
because there was no PHPMailerAutoload, but i've got another error:
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\sites\www\record_tech\phpmailer1\class.phpmailer.php on line 45
Fatal error: Cannot instantiate non-existent class: phpmailer in d:\sites\www\record_tech\sender.php on line 5 I can't update this server to php 5 and have to resolve this problem on php4.