电子邮件发送时间显示amqp(Rabbitmq)开始时间

时间:2014-12-04 15:51:04

标签: php email header rabbitmq amqp

我正在使用Rabbitmq(amqp),这是代码片段,

 fucntion sendMail(){
    $this->load->library('email');
    $this->email->set_newline("\r\n");
    $connection = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
    $channel = $connection->channel();
    $channel->queue_declare(EQUE_NAME, false, true, false, false);
    $callback = function($msg) {
        $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
        $temp = json_decode($msg->body);
        $this->email->from(FROM, FROM_NAME);
        $this->email->to($temp->to);
        //$dt = date('Y-m-d H:i:s');
        //$this->email->Date($dt);
        $this->email->subject($temp->subject);
        $email = $this->load->view('email/' . $temp->template, $temp->params, TRUE);
        $this->email->message($email);
        if ($this->email->send()) {
            echo 'Your email was sent on ' . date('Y-m-d H:i:s');
        } else {
            show_error($this->email->print_debugger());
        }
    };
  }

我只是将数据传递给这个函数,

 sendMail($email, SUBJECT_ACC_ACTIVATION, $signup);

所以问题是当电子邮件发送时,它显示错误的发送时间。 它显示了队列开始的时间!

0 个答案:

没有答案