Copy link to clipboard
Copied
I have a client who wants to be able to send an email to a generic address like kickoff@mydomain.com and have that trigger a .cfm page.
I have no idea if this is possible or not but I'm assuming it would be something like Facebook's reply to comment via email feature where a user replies to an automatic email and then when the reply is recieved by the server it runs an insert statement.
Can someone help me understand how to approach this?
High level solution...
Step 1: User sends email to generic email address
Step 2: Server interprets request and kicks off cfm page
Step 3: cfm page runs as expected
Copy link to clipboard
Copied
You could use CFSCHEDULE to create a task that regularly checks an email box using CFPOP and performs some action based on the content of the mail message(s) in the mail box.
Copy link to clipboard
Copied
Yes this can be done, sort of. It cannot actually "trigger" an immediate action on ColdFusion's part, but you can have a scheduled CF task that runs on a regular basis (every 5 minutes, etc), to check the inbox. I received hundreds of emails per day containing data files from customers, and process them all with a CF task that periodically checks each of the inboxes for new mail.
Depending on the mail service you are dealing with, you have <CFPOP>, <CFEXCHANGE> (CF 8+), or <CFIMAP> (CF 9) to work with.
One of the tricky things is marking the messages you process so that you don't keep processing the same messages over and over. I have found that with CFEXCHANGE I can use the isRead flag to do this. I have an older script that uses an IMAP CFC that was available at the time, and with it I need to use the "deleted" flag for a message to mark that I've seen it.
You can use both the IMAP and EXCHANGE tags to work with MS Exchange servers, but if you use the IMAP tag then you need to be sure that the mailbox is setup for IMAP access. If you use the EXCHANGE tag then you need to be sure that the mailbox is setup for OWE access.
Hope this helps,
-reed
Copy link to clipboard
Copied
I've done some searching on google and yahoo to try to find examples of how to specifically check the inbox ("Depending on the mail service you are dealing with, you have <CFPOP>, <CFEXCHANGE> (CF 8+), or <CFIMAP> (CF 9) to work with.") but haven't found anything useful.
Can you please show me some pseudo code using cfpop let's say on how to check the inbox and then flag messages?
Thank you!!
Copy link to clipboard
Copied
Take a look at the CF documentation. It includes sample code for checking a mail box with CFPOP.
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec14b97-7feb.html
What do you mean by "flag messages"?
Copy link to clipboard
Copied
If you're using POP, then there are a lot of examples (but a lot of them will look the same) in each version of Livedocs and each edition of CFWACK, as well as most of the other CF books running around. I'm pretty sure that one(which means it and all later editions) of the CFWACK editions has an example for building a simple POP-based mail client in CF.
POP is pretty simple. If you need access to boxes other than the Inbox, for example, you'll need IMAP/MAPI.
-reed
Copy link to clipboard
Copied
if I want only inbox folder mail, then which one is faster cfimap or cfpop?
Copy link to clipboard
Copied
Why don't you try them both and find out?
Copy link to clipboard
Copied
Ok. let me try both of it. Thanks