Asked  7 Months ago    Answers:  5   Viewed   65 times

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 = "";
$mail->Port = 465;

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

$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/ on line 271

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

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

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



Encoding is not a variable: $this->Encoding

Saturday, May 29, 2021
answered 7 Months ago

First thing notice off-hand: Gmail uses TLS. Don't know if having SSL instead of TLS will make much of a difference but SSL is the predecessor to TLS.

I recommend checking out also, its phpmailer customized for using gmail. PHPGMailer

Wednesday, March 31, 2021
answered 9 Months ago

Any developer with access to your code will be able to access your credentials. Saving these in a database may make it a little tougher to gain access to the details, but only slightly.

If you are truly concerned about the credentials used, create an account dedicated to your site and do not use a personal account.

Wednesday, March 31, 2021
answered 9 Months ago

Try with return num_rows();


class Dash_model extends CI_Model {

public function __construct() {

public function testtotal() {
     $this->db->from($this->db->dbprefix . 'transaction_table'); 
     $this->db->where('transaction_id', '5');
     $this->db->or_where('transaction_id', '4');
     $query = $this->db->get();
     return $query->num_rows();



Using DB where

I would recommend auto load your database

$autoload['libraries'] = array('database');

Codeigniter Query Builder Class

Codeigniter Doc's

Saturday, May 29, 2021
answered 7 Months ago

The validation rules you are using are correct. Just remove few rules those are not required

$this->form_validation->set_rules('email', '<b>email</b>', 'required|valid_email|callback_mail_check');

The callback automatically add the parameter of current validation. You don't need to read it from GET/POST method.

public function mail_check($email)
    if (!$this->users_model->get_user_by_email_address($email)) {

        $this->form_validation->set_message(__FUNCTION__, 'Your <b>email</b> could not be found.');
        return false;
    return true;
Saturday, May 29, 2021
answered 7 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :