# A Peek Behind the Mail Curtain

DevFeed: [A Peek Behind the Mail Curtain](<https://devfeed.tech/articles/a-peek-behind-the-mail-curtain-20486.md>)

Original publisher: [Read original article](<https://yahooeng.tumblr.com/post/174023151641>)

Author: marcelatoath

Published: 2018-05-18T16:19:38Z

Content type: tutorial

Language: en

Sources: [Yahoo](<https://devfeed.tech/sources/yahoo.md>)

Topics: [email](<https://devfeed.tech/topics/email.md>), [Server](<https://devfeed.tech/topics/server.md>), [TLS (Transport Layer Security)](<https://devfeed.tech/topics/tls.md>)

Tags: [aol](<https://devfeed.tech/tags/aol.md>), [features](<https://devfeed.tech/tags/features.md>), [imap](<https://devfeed.tech/tags/imap.md>), [mail](<https://devfeed.tech/tags/mail.md>), [yahoo](<https://devfeed.tech/tags/yahoo.md>), [yahoo-engineering](<https://devfeed.tech/tags/yahoo-engineering.md>)

## AI overview

Yahoo and AOL Mail let developers retrieve message tags through IMAP: connect to the Yahoo IMAP server, log in, select a folder, search for message UIDs, then fetch X-MSG-DECOS, X-MSG-ID, and X-MSG-THREADID for a UID. The example returns DECOS values and a thread ID; the post says these tags support travel and shopping views and message threading, but does not explain their internal processing.

## Source excerpt

USE IMAP TO ACCESS SOME UNIQUE FEATURES By Libby Lin, Principal Product Manager Well, we actually won't show you how we create the magic in our big OATH consumer mail factory. But nevertheless we wanted to share how interested developers could leverage some of our unique features we offer for our Yahoo and AOL Mail customers. To drive experiences like our travel and shopping smart views or message threading, we tag qualified mails with something we call DECOS and THREADID. While we will not indulge in explaining how exactly we use them internally, we wanted to share how they can be used and accessed through IMAP. So let's just look at a sample IMAP command chain. We'll just assume that you are familiar with the IMAP protocol at this point and you know how to properly talk to an IMAP server. So here's how you would retrieve DECO and THREADIDs for specific messages: 1. CONNECT openssl s_client -crlf -connect imap.mail.yahoo.com:993 2. LOGIN a login username password a OK LOGIN completed 3. LIST FOLDERS a list "" "*" * LIST (\Junk \HasNoChildren) "/" "Bulk Mail" * LIST (\Archive \HasNoChildren) "/" "Archive" * LIST (\Drafts \HasNoChildren) "/" "Draft" * LIST (\HasNoChildren) "/" "Inbox" * LIST (\HasNoChildren) "/" "Notes" * LIST (\Sent \HasNoChildren) "/" "Sent" * LIST (\Trash \HasChildren) "/" "Trash" * LIST (\HasNoChildren) "/" "Trash/l2" * LIST (\HasChildren) "/" "test level 1" * LIST (\HasNoChildren) "/" "test level 1/nestedfolder" * LIST (\HasNoChildren) "/" "test level 1/test level 2" * LIST (\HasNoChildren) "/" "&T2BZfXso-" * LIST (\HasNoChildren) "/" "&gQKAqk7WWr12hA-" a OK LIST completed 4.SELECT FOLDER a select inbox * 94 EXISTS * 0 RECENT * OK [UIDVALIDITY 1453335194] UIDs valid * OK [UIDNEXT 40213] Predicted next UID * FLAGS (\Answered \Deleted \Draft \Flagged \Seen $Forwarded $Junk $NotJunk) * OK [PERMANENTFLAGS (\Answered \Deleted \Draft \Flagged \Seen $Forwarded $Junk $NotJunk)] Permanent flags * OK [HIGHESTMODSEQ 205] a OK [READ-WRITE] SELECT completed;