致命错误:找不到类'Swift_SmtpTransport'

时间:2016-07-09 07:14:16

标签: php swiftmailer oscommerce

我正在尝试使用SwiftMailer在注册时发送此邮件,但它不断抛出此错误。

我正在为osCommerce使用这个附加组件: http://addons.oscommerce.com/info/901

我已按照他所说的确切说明。同时添加权限仍然是一样的。

我发布以下代码:

CODE:

      if (EMAIL_TRANSPORT == 'smtp') {
    include_once(DIR_FS_CATALOG.DIR_WS_CLASSES . 'SwiftEmailer/swift_required.php');

    $body             = $this->html;
    $body             = preg_replace("[]",'',$body);

    $host_name = explode('://',EMAIL_SMTP_HOST_SERVER);
    if(count($host_name)>1){
        $transport        = Swift_SmtpTransport::newInstance($host_name[1], EMAIL_SMTP_PORT_SERVER, $host_name[0])
            ->setUsername(EMAIL_SMTP_USERNAME)
            ->setPassword(EMAIL_SMTP_PASSWORD);
    } else {
        $transport        = Swift_SmtpTransport::newInstance(EMAIL_SMTP_HOST_SERVER, EMAIL_SMTP_PORT_SERVER)
            ->setUsername(EMAIL_SMTP_USERNAME)
            ->setPassword(EMAIL_SMTP_PASSWORD);
    }


    $mailer           = Swift_Mailer::newInstance($transport);
    $message          = Swift_Message::newInstance($subject)
      ->setFrom(array($from_addr => $from_name))
      ->setTo(array($to_addr => $to_name))
      ->setMaxLineLength(50);


    if($body){
        $message->setBody($body, 'text/html', CHARSET);
    }
    if($this->text){
        $message->setBody($this->text, 'text/plain', CHARSET);
    }
    else{
        $message->setBody($this->html_text, 'text/html', CHARSET);
    }

    $mailer->send($message);
  }

如果有人能帮助我解决这个问题,那就太好了。谢谢

0 个答案:

没有答案