Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 978
piernik Avatar asked Dec 19 '11 12:12

piernik


People also ask

Why it is advantages to use PHPMailer for sending and receiving email?

It can print various kinds of error messages in more than 40 languages when it fails to send an email. It has integrated SMTP protocol support and authentication over SSL and TLS. It can send an alternative plain-text version of email for non-HTML email clients.

How many emails can I send with PHPMailer?

Its called SMTP Relays and it is defined on a per (sending) email basis but usually defaults to 250.

Why does PHPMailer go to spam?

usually this happens because the sending server is already marked as spam by somebody. The way i found is go to the gmail account mark the item as 'important' in gmail and 'Add to Safe senders' in Outlook.

What mail server does PHP mail use?

Php uses by default, the local mail-server.


1 Answers

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");
}
like image 135
Nabab Avatar answered Oct 21 '22 07:10

Nabab