简体   繁体   中英

Edit an email subject line (IMAP)

I am trying to integrate IMAP email processing with another in house system that bases what it uses off of the subject line / email content.

We need to be able to change the text of the subject line before moving the email to a new folder. What/where would be a good place to start?

I've had a look around and it IS possible in a manual sense, via a thunderbird plugin or using outlook. I just can't seem to find a relevant example in PHP, or any other language for that matter. I also hear the idea is flakey at best as you need to modify the email content and upload it back to the imap server.

The outlook implementation seems to delete the original and save a new one to your IMAP folder on the server.

Side note: Yes I know it is a weird requirement, and although forwarding the email to ourselves then moving it is our fall back plan it is not much liked as it moves original headers useful for things like reply-all.

Any suggestions appreciated.

PS If I'm blind and there is something obvious I'm missing in the manual let me know.

Do you already have any code built to handle the email processing? IMAP subject line information is stored as a header so you would need to utilize the PHP functions of imap_headerinfo() and/or imap_fetchheader() depending on the functionality you're looking for to achieve this. You could have PHP check each message header and if it matches X format, remove the message, and create a new one with the appropriately modified header information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM