3

When sending an email through our CRM system, I'd like to put a copy of the email sent in the relevant staff members Sent folder. This works no worries in Gmail/Google Apps which automatically stores emails sent through their SMTP server in the Sent folder, but most mail servers don't work like this. Besides moving everyone over to Google Apps or (B)CC'ing the sender on each email, is there any way I can actually do this?

I can open the connection easily enough using cfimap, send the email using cfmail, but how do I then store that sent email into the sent folder?! It's easy enough to move one email from one folder to another using cfimap, but I can't figure out how to get the right messagenumber for the email just sent via the mail server and move that one into the Sent folder. Even if I had to regenerate the entire email and then save it, there doesn't seem to be anything like php's imap-append?

I see that in Bluedragon there is an imapconnection and imapfolder option, which would be perfect, but these don't work in plain old cfml.

I have been googling this for a few days now, and also checked out a bunch of similar threads on SO. Most are answered with 'put an email address on (B)CC', which is of course an option, but I don't want to immediately give up on my ideal solution.

Any ideas, or is this is a dead end?!

sckd
  • 405
  • 3
  • 11
  • **Put an email address on BCC.** You've not given any reason why what you're trying is better than doing this, so why are you creating unnecessary work? – Peter Boughton Oct 17 '13 at 08:50
  • The reason that what he is trying is better than bcc-ing the person is that the desired result gets achieved without that person having to do any work. – Dan Bracuk Oct 17 '13 at 12:05
  • What person having to do any work? The email is sent via a CRM; it's no extra work. – Peter Boughton Oct 17 '13 at 12:11
  • 1
    The extra work is on the person's email client. Once he receives his bcc copy he has to move it to his Sent folder. That's the step sckd is looking to automate. – Dan Bracuk Oct 17 '13 at 12:23
  • Ok, so the real question is for a way to [create filters over IMAP](http://stackoverflow.com/questions/4445878/how-do-you-add-an-email-filter-to-an-imap-email-account) - i.e. instead of going in after every message is sent and manually creating it, just create a filter once that moves messages based on the presence of a certain header. If cfimap can't do that then something like [jSieve](http://james.apache.org/jsieve/index.html) or [ManageSieveJ](https://github.com/Moosemorals/ManageSieveJ) probably can. – Peter Boughton Oct 17 '13 at 12:36
  • I can of course put the sender on BCC as I mention in my question (and obviously a rule/filter our end is dead easy), but that is not my ideal solution (it is my backup plan). I'm a sucker for problem solving, so I also just want to know after spending so many hours on it, if it's even possible or not, but it actually seems it isn't. – sckd Oct 18 '13 at 09:37

1 Answers1

2

Having researched this for days on end, eventually I came to the conclusion that this can not be done using cfimap/cfmail at this time (CF10). The solution I ended up implementing is to add a mailerid header to each email and BCC an email alias for each email that needed storing in the company's imap solution. A rule then moves all emails with that mailerid to a certain folder so they have a copy.

sckd
  • 405
  • 3
  • 11