Difference between pop3 and imap
POP3 and IMAP are two different protocols (methods) used to access email.
Of the two, IMAP is the best option and the recommended option when you need to check your emails from multiple devices, such as a work laptop, home computer or tablet, smartphone or other mobile device. Click on your synced (updated) account from any device using IMAP.
POP3 downloads email from a server to one computer and then deletes it from the server. Since your messages are downloaded to one computer or device and then deleted from the server, it may seem like your mail has gone missing or disappeared from your Inbox if you try to check your mail from another computer.
source to share
If you read the documentation for the cfpop and cfimap tags, I think you will understand.
Reply for comment
The main thing you need to understand is that you won't be able to make a search request to the server and only receive search bar emails.
<cfimap action="open" connection="Conn" server="imap.gmail.com" username="xxxxxxx@foo.bar" password="password" secure="yes" port="993" >
<cfimap action="getAll" connection="Conn" name="EmailQueryName" folder="Inbox" maxrows="1">
The above opens a connection and reads emails. maxrows="1"
means we only select one row. This is added for testing purposes only. action="getAll"
or action="GETHEADERONLY"
creates a query with a variable name name="EmailQueryName"
. You can also specify the attribute attachmentpath
that is used to save attachments. The query that will be returned will have columns of type ANSWERED, ATTACHMENTFILES, ATTACHMENTS, BODY, CC, CIDS, DELETED, DRAFT, FLAGGED, FROM, HEADER, HTMLBODY, LINES, MESSAGEID, MESSAGENUMBER, RECENT, REPLYTO, RXDDATE, SEEN, SENTDATE, SIZE, SUBJECT, TEXTBODY, TO, UID
. Using this, you can use Query of Query to filter the data, or you can even save the data to the database before doing so.
If you are going to receive all of your emails, it will take a long time and make sure the request timeout value is high.
source to share