I have a CF form that when posted sends an email with an attachment from our website to an email specified in the form.
The email is sent using the CFMAIL tag.
Pretty straight forward.
Now for compliance reasons I need to keep records of what was sent to whom and when.
Ideally I'd like to run the emails though our mail server and not the CF server.
Is something like that possible?
Your emails are already being sent via a mailserver. The CF server merely interfaces with it on your behalf. Either you specify the mailserver to use in the <cfmail> tag, or more likely you specify it in the Mail settings in the CF Administrator
Before/After email is sent, you could insert the content of the email into database. That way, you will have records of the email.
Create a table and name "email".
Add columns: email_id, from, to, subject, body, date_sent
You could you add other columns such as cc and bcc.