PHP, PHPMailer: Can't get example code for PHPMailer to work

Question!

I'm trying to get php mailer to work. I'm getting an error but couldn't find any info from google on it.

$mail = new phpmailer;

$mail->IsSMTP(); // set mailer to use SMTP
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;

$mail->From = "[email protected]";
$mail->FromName = "Mailer";
$mail->AddAddress("[email protected]", "User");
//$mail->AddAddress("[email protected]");   // name is optional
$mail->AddReplyTo("[email protected]", "Information");
$mail->WordWrap = 50;    // set word wrap
//$mail->AddAttachment("c:\\temp\\js-bak.sql");  // add attachments
//$mail->AddAttachment("c:/temp/11-10-00.zip");

$mail->IsHTML(true);    // set email format to HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the message body";
$mail->Send(); // send message

The code above is what I'm using but when I try to run it I get the following in my browser...

Fatal error: Cannot access empty property in /the/full/path/to/phpmailer.inc.php on line 271

Here is the line it's referring to...

$header[] = sprintf("Content-Transfer-Encoding: %s\n", $this->$Encoding);

If anyone can help it would be greatly appreciated! Thanks.

By : daveomcd


This video can help you solving your question :)
By: admin

PHPMailer SMTP Error 550

My server and php mail() function sends email to the spam folder

How to use PHPmailer? Help me with its API

PHPMailer Lite & GMAIL SMTP: emails not sent to Yahoo Mail, how to debug?

PHP, PHPMailer: Can't get example code for PHPMailer to work

PHPMailer Works on WAMP but not on Production Server

sending email using gmail server [duplicate]

fsockopen returns 'bool(false)' from browser but 'resource(4) of type (stream)' from command line

PHP on GoDaddy Linux Shared trying to send through GMAIL SMTP

PHPMailer or SwiftMailer? [duplicate]

Problem with SMTP emails sent via PhpMailer: Helo Not Accepted