使用smtp发送邮件并将其反映在电子邮件服务器的“已发送”文件夹中

使用smtp发送邮件并将其反映在电子邮件服务器的“已发送”文件夹中

问题描述:

I am sending email using SMTP in my application. The emails are going through, but they are not showing up in the Sent folder of the sender on the mailserver :(

Here is the code which I use to send the mails:

$emailConfig = array(                           
  "mailtype"  => "html",
  "protocol"  => "smtp",
  "smtp_host"  => "host",
  "smtp_user"  => "user",
  "smtp_pass"  => "password",
  "smtp_port"  => "port"                
);              

$this->load->library('email', $emailConfig);
$this->email->from("from");         
$this->email->to("to");         
$this->email->message("message");    
$this->email->subject("subject");    
@$this->email->send();

I searched a lot for a solution, unfortunately it didn't help me.

Although I got some suggestions: "send email via smtp and store the mail via IMAP in the Sent IMAP folder".

Is this work for me or is there any other way to handle this issue?

我在我的应用程序中使用SMTP发送电子邮件。 电子邮件正在通过,但它们没有显示在邮件服务器上发件人的已发送 code>文件夹中:( p>

这是我用来使用的代码 发送邮件: p>

  $ emailConfig = array(
“mailtype”=>“html”,
“protocol”=>“smtp”,
“  smtp_host“=>”host“,
”smtp_user“=>”用户“,
”smtp_pass“=>”密码“,
”smtp_port“=>”port“
); 
  
 $ this-> load-> library('email',$ emailConfig); 
 $ this-> email-> from(“from”); 
 $ this-> email->  to(“to”); 
 $ this-> email-> message(“message”); 
 $ this-> email-> subject(“subject”); 
 @ $ this-&gt  ; email-> send(); 
  code>  pre> 
 
 

我搜索了很多解决方案,遗憾的是它没有帮助我。 p>

虽然我收到了一些建议:“通过smtp发送电子邮件并通过IMAP将邮件存储在Sent IMAP文件夹中” em>。 p>

这对我有用吗 或者还有其他任何方式 这个问题? p> div>

Sending a mail (with SMTP) and storing it in the Sent folder (with IMAP) are two different things, although most mail client does this concurrently. There are very specific SMTP servers (best example is the gmail), who can store a copy of the sent mails in the "Sent" IMAP-Folder of the actual user, but this is an extraordinary feature and most server doesn't do this.

The php mailing library, which you are using, is probably capable to do this as well.

But in your code fragment there is nothing about the IMAP configuration. You should set it also up.