This question already has an answer here:
I am keep getting this error when I wrote my Email class in php.
class Email {
public $mail;
function __construct() {
$this->$mail = new PHPMailer(true);
$this->$mail->SMTPDebug=1;
$this->$mail->isSMTP();
$this->$mail->SMTPAuth = true;
$this->$mail->Host = '************'
$this->$mail->SMTPSecure = 'ssl';
$this->$mail->Port = 465;
$this->$mail->Hostname = '************';
$this->$mail->CharSet = 'UTF-8';
$this->$mail->FromName = '*************';
$this->$mail->Username = '*************';
$this->$mail->Password = '**************';
$this->$mail->From ='***********';
}
When I new a Email Class, it said cannot access empty property at
$this->$mail = new PHPMailer(true);
I have tried to do this
public $mail = new PHPMailer();
it said it is a syntax error.
Can someone help?
</div>