phpsmtpimapphpmailer

Sent mails with phpmailer don't go to "Sent" IMAP folder


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 thing. How to make sent with phpmailer script mails go to "Sent" IMAP folder?


Solution

  • There is now a method getSentMIMEMessage in PHPMailer which returns the whole MIME string

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