Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在已发送文件夹中看不到已发送的Codeigniter消息_Php_Codeigniter_Email - Fatal编程技术网

Php 在已发送文件夹中看不到已发送的Codeigniter消息

Php 在已发送文件夹中看不到已发送的Codeigniter消息,php,codeigniter,email,Php,Codeigniter,Email,我现在可以发送电子邮件,但我的问题是,当我使用yahoo或outlook帐户时,发送的邮件不会反映在“已发送”文件夹中,但可以在收件人的收件箱中看到该邮件: public function send_mail(){ $this->load->helper('path'); // Storing submitted values $sender_email = 'test@yahoo.com'; $user_password = 'test'; $receiver_email =

我现在可以发送电子邮件,但我的问题是,当我使用yahoo或outlook帐户时,发送的邮件不会反映在“已发送”文件夹中,但可以在收件人的收件箱中看到该邮件:

public function send_mail(){

 $this->load->helper('path');
// Storing submitted values
$sender_email = 'test@yahoo.com';
$user_password = 'test';
$receiver_email = $this->input->post('to_email');
$username = 'test';
$subject = $this->input->post('subject');
$message = $this->input->post('message');
$attachment = $this->input->post('upload');



// Configure email library
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.mail.yahoo.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = $sender_email;
$config['smtp_pass'] = $user_password;
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;

// Load email library and passing configured values to email library
$this->load->library('email', $config);
$this->email->set_newline("\r\n");

// Sender email address
$this->email->from($sender_email, $username);
// Receiver email address
$this->email->to($receiver_email);
// Subject of email
$this->email->subject($subject);
// Message in email
$this->email->message($message);
//attachment
$this->load->library('upload');

$size = $_FILES['upload']['size'][0];


if($size>0){
  $aConfig['upload_path'] = './uploads';
  $aConfig['allowed_types']    = '*';
  $aConfig['max_size']     = '250000';
  $aConfig['max_width']        = '1280';
  $aConfig['max_height']       = '1024';

  $files = $_FILES;
  $cpt = count($_FILES['upload']['name']); 
  for($i=0; $i<$cpt; $i++)
  {           

      $_FILES['upload']['name']= $files['upload']['name'][$i];
      $_FILES['upload']['type']= $files['upload']['type'][$i];
      $_FILES['upload']['tmp_name']= $files['upload']['tmp_name'][$i];
      $_FILES['upload']['error']= $files['upload']['error'][$i];
      $_FILES['upload']['size']= $files['upload']['size'][$i];   

      $this->upload->initialize($aConfig);
      if($this->upload->do_upload('upload'))
      {
        $ret = $this->upload->data();

      } else {
       print_r('ATTACHMENT NOT SUPPORTED');die();
      }
      $pathToUploadedFile = $ret['full_path'];
      $this->email->attach($pathToUploadedFile);

  }

  $path = $ret['file_path'];
  $files = glob($path.'*');

  foreach($files as $file){
    if(is_file($file)){
      unlink($file);
    }
  }

}

if ($this->email->send()) {

  // echo '<script>alert("Email successfully sent!");</script>';
    // $this->load->view('BASE_URL . "".$this->uri->segment(1)."/compose');
   $this->email->clear(TRUE);
   $this->session->set_flashdata('message', 'sent_msg');
   redirect(BASE_URL.'tenant/compose');
} else {

   // $this->load->view('tenant/compose');
  $this->email->clear(TRUE);
  $this->session->set_flashdata('message', 'Email not sent!');
   redirect(BASE_URL.'tenant/compose');
}
public函数发送邮件(){
$this->load->helper('path');
//存储提交的值
$sender\u email='1test@yahoo.com';
$user_password='test';
$receiver_email=$this->input->post('to_email');
$username='test';
$subject=$this->input->post('subject');
$message=$this->input->post('message');
$attachment=$this->input->post('upload');
//配置电子邮件库
$config['protocol']='smtp';
$config['smtp_主机']='ssl://smtp.mail.yahoo.com';
$config['smtp_port']=465;
$config['smtp_user']=$sender_email;
$config['smtp_pass']=$user_password;
$config['mailtype']='html';
$config['charset']='iso-8859-1';
$config['wordwrap']=TRUE;
//加载电子邮件库并将配置的值传递给电子邮件库
$this->load->library('email',$config);
$this->email->set_newline(“\r\n”);
//发件人电子邮件地址
$this->email->from($sender\u email,$username);
//收件人电子邮件地址
$this->email->to($receiver\u email);
//电子邮件主题
$this->email->subject($subject);
//电子邮件中的消息
$this->email->message($message);
//附件:
$this->load->library('upload');
$size=$_文件['upload']['size'][0];
如果($size>0){
$aConfig['upload_path']='./uploads';
$aConfig['allowed_types']='*';
$aConfig['max_size']='250000';
$aConfig['max_width']='1280';
$aConfig['max_height']='1024';
$files=$\u文件;
$cpt=count($_文件['upload']['name']);
对于($i=0;$iupload->initialize($aConfig);
如果($this->upload->do_upload('upload'))
{
$ret=$this->upload->data();
}否则{
打印(不支持附件);模具();
}
$pathtouploadefile=$ret['full_path'];
$this->email->attach($pathtoploadedfile);
}
$path=$ret['file_path'];
$files=glob($path.'*');
foreach($files作为$file){
if(is_文件($file)){
取消链接($文件);
}
}
}
如果($this->email->send()){
//回显“警报”(“电子邮件已成功发送!”);
//$this->load->view('BASE_URL.“$this->uri->segment(1)。”/compose');
$this->email->clear(TRUE);
$this->session->set_flashdata('message'、'sent_msg');
重定向(基本URL“租户/组合”);
}否则{
//$this->load->view('tenant/compose');
$this->email->clear(TRUE);
$this->session->set_flashdata('message','Email not sent!');
重定向(基本URL“租户/组合”);
}
}


提前谢谢各位

签入垃圾邮件文件夹我的意思是,发送的邮件无法在发送文件夹中显示,作为邮件已发送的证据。是吗?不是,先生,当我使用ci中的代码发送邮件时,我可以发送邮件,但发送的邮件无法在雅虎的发送文件夹中显示,作为邮件已发送的证据已发送,但当我使用yahoo mail发送电子邮件时,发送的邮件会反映在垃圾邮件文件夹中yahoocheck的sent文件夹上。我的意思是,无法在sent文件夹上看到发送的邮件作为邮件已发送的证据。可能是这样吗?否,先生,当我使用ci中的代码发送邮件时,我可以发送,但发送的邮件可以在yahoo的sent文件夹上看不到邮件已经发送的证据,但当我使用yahoo mail发送电子邮件时,发送的邮件会反映在yahoo的sent文件夹上