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);
更多回答
优秀答案推荐
This error means that the $gnl variable is actually a string rather than an object which you assume it is.
这个错误意味着$GNL变量实际上是一个字符串,而不是您假设的对象。
Do a bit of ddd() debugging earlier on to see where the $gnl variable comes from.
在前面进行一点DDD()调试,看看$GNL变量来自哪里。
Verify that the property name 'email_from' exists in the $gnl
object and that it's spelled correctly.
验证属性名称‘EMAIL_FROM’是否存在于$GNL对象中并且拼写是否正确。
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.";
}
更多回答
我是一名优秀的程序员,十分优秀!