I want to append a message to a imap sentbox – the code below does just that however treats the message as new.
From my understanding adding the SEEN option should mark it as read however I’ve tried every possible location for the option but still messages are marked as new.
Having looked at imap_setflag_full, this requires a mail number to set the flag and given that the email has just been added, I see no way to grab the number to set the flag(?).
Any suggestions?
imap_append($inbox, "{mail.domain.com:143/imap/notls}INBOX.Sent"
, "From: $fromaddress\r\n"
. "To: $toaddress\r\n"
. "Subject: [Email Processed] $subject\r\n"
. "Date: $date_return \r\n"
. "X-Mailer: Cmail_v2.0 \r\n"
. "X-Originating-IP: {$_SERVER['REMOTE_ADDR']}\r\n"
. "MIME-Version: 1 \r\n"
. "Content-Type: text/html;\r\n\tcharset=\"ISO-8859-1\"\r\n"
. "Content-Transfer-Encoding: 8bit \r\n"
. "\r\n\r\n"
. "$message_return \r\n"
);
Pass your flags through the
$optionsargument.http://php.net/manual/en/function.imap-append.php#74907
EDIT:
After reading your post again, I realized that you might already be passing the flag through the $options parameter. That’s good, but if you are passing “SEEN” then that is your problem. The IMAP4 RFC: Section 2.3.2. Flags Message Attribute defines it as “\Seen” with a backslash and capital S. Does that flag string fix your problem?