发送邮件“ $ mail-> send();”时为null从发送功能

时间:2018-07-24 06:22:15

标签: php opencart phpmailer

我试图从服务器发送邮件。我已经在我的邮件功能中设置了cc,to,bcc,message等邮件。发送邮件时,此功能为“ $ mail-> send();”。返回“ null”我不知道背后的原因是什么,请您帮我解决这个问题?

我的邮件功能是

$mail = new Mail();
        $mail->protocol = $this->config->get('config_mail_protocol');
        $mail->parameter = $this->config->get('config_mail_parameter');
        $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
        $mail->smtp_username = $this->config->get('config_mail_smtp_username');

        $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
        $mail->smtp_port = $this->config->get('config_mail_smtp_port');
        $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');

        $mail->setTo($to);
        $mail->setBcc("test@gmail.com");
        $mail->setFrom($data["email"]);
        $mail->setSender(html_entity_decode($data["full_name"], ENT_QUOTES, 'UTF-8'));
        $mail->setSubject($subject);
        $mail->setText($body);

        $mailData= $mail->send();
var_dump($mailData); die;

$mailData显示为空。

谢谢。

0 个答案:

没有答案