Sent mails with phpmailer don't go to “Sent” IMAP folder

前端 未结 5 746
我寻月下人不归
我寻月下人不归 2020-11-29 11:22

in my CRM online system I control ingoing mails with IMAP protocol. Now I\'m making sending mails with phpmailer and SMTP protocol. Everything is ok but I have one wierd thi

5条回答
  •  旧巷少年郎
    2020-11-29 12:05

    I found easier way to do this. PHPmailer prepares email as string - all You have to do is to put it into right IMAP folder.

    I expanded phpmailer class with this code (since vars are protected I can't reach them):

    class PHPMailer_mine extends PHPMailer {
    public function get_mail_string() {
        return $this->MIMEHeader.$this->MIMEBody;
    }}
    

    PHP code:

    $mail= new PHPMailer_mine();
    //code to handle phpmailer
    $result=$mail->Send();
    if ($result) {
        $mail_string=$mail->get_mail_string();
        imap_append($ImapStream, $folder, $mail_string, "\\Seen");
    }
    

    It works well.

提交回复
热议问题