skip to Main Content

Having error from this

           $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;        
        }        
        $mail->Port       = $config->port;        
        $mail->CharSet = 'UTF-8';        
        //Recipients        
        $mail->setFrom($gnl->email_from, $gnl->sitetitle);        
        $mail->addAddress($receiver_email, $receiver_name);        
        $mail->addReplyTo($gnl->email_from, $gnl->sitename);        
        // Content        
        $mail->isHTML(true);        
        $mail->Subject = $subject;

This is were my error is from

$mail->setFrom($gnl->email_from, $gnl->sitetitle);

2

Answers


  1. Verify that the property name ’email_from’ exists in the $gnl object and that it’s spelled correctly.

    if (is_object($gnl)) {
        if (property_exists($gnl, 'email_from')) {
            $mail->setFrom($gnl->email_from, $gnl->sitetitle);
        } else {
            echo "Property 'email_from' does not exist in the $gnl object.";
        }
    } else {
        echo "$gnl is not an object.";
    }
    
    Login or Signup to reply.
  2. This error means that the $gnl variable is actually a string rather than an object which you assume it is.

    Do a bit of ddd() debugging earlier on to see where the $gnl variable comes from.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search