Answers.Body: <p>You could look at the <a href="https://civicrm.org/extensions/transactional-emails" rel="nofollow noreferrer">Transactional Mail</a> extension which ensures everything going out from eg Sch Reminders, Receipts etc are stored as Activities on the contact</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-23T08:39:59.330Z
Answers.Text: Lots of great answers to think about and reflect on. In the end, I think this is the one that best meets the client needs :)
Answers.UserDisplayName: michaelmcandrew
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-23T22:45:44.267Z
Answers.Text: good to know it is of use
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-17T09:53:59.703Z
Answers.LastActivityDate: 2020-01-17T09:53:59.703Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>In civicrm.settings.php there's some settings to log it all to a file. See <a href="https://docs.civicrm.org/dev/en/latest/tools/debugging/#changing-file-based-settings" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/tools/debugging/#changing-file-based-settings</a></p>
  
  <pre><code>define('CIVICRM_MAIL_LOG', '/file/path');
  define('CIVICRM_MAIL_LOG_AND_SEND', 1);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-15T13:48:26.923Z
Answers.Text: Thats gonna get pretty huge if your sending a lot of emails. Our approach is to use the sending gateways logging/audit processes. Although they do not normally keep for more than 14 days or so, some do. I guess the real question is what are objectives of keeping the logs?
Answers.UserDisplayName: Parvez Saleh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-15T16:35:42.993Z
Answers.Text: thanks @Demerit - I didn't know about CIVICRM_MAIL_LOG_AND_SEND.
Answers.UserDisplayName: michaelmcandrew
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-15T16:38:05.383Z
Answers.Text: @ParvezSaleh - good question. The client had a bad experience sending mail from civicrm in the past and wants to keep an eye on what is being sent. Hence needs to be client user friendly.
Answers.UserDisplayName: michaelmcandrew
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-16T20:14:56.917Z
Answers.Text: Was the bad experience with the design/look and feel of the emails or the deliverability?
Answers.UserDisplayName: Luke Stewart
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-22T15:40:05.733Z
Answers.Text: Good question. Not 100%. My hunch was deliverability and just not being sure of what was getting sent, what each email contained, etc.
Answers.UserDisplayName: michaelmcandrew
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-15T13:44:29.587Z
Answers.LastActivityDate: 2020-01-16T17:28:21.327Z
Answers.LastEditDate: 2020-01-16T17:28:21.327Z
Answers.UserDisplayName: Demerit
Answers.Body: <p>If it's your current MTA, Postfix has an option to BCC all emails to an address: <code>always_bcc</code></p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/1491552/i-would-like-to-add-a-bcc-to-all-mails-going-out-from-my-postfix#1491586">https://stackoverflow.com/questions/1491552/i-would-like-to-add-a-bcc-to-all-mails-going-out-from-my-postfix#1491586</a></li>
  <li><a href="http://www.postfix.org/ADDRESS_REWRITING_README.html" rel="nofollow noreferrer">http://www.postfix.org/ADDRESS_REWRITING_README.html</a></li>
  </ul>
  
  <p>More complex solutions can be implemented.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-15T17:15:20.810Z
Answers.Text: Any debug methods which use SMTP may have impact on your civimail, eg if you debug by sending many emails to a single mailbox at a given mail provider, this might affect your spam reputation with them.
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-15T17:08:56.437Z
Answers.LastActivityDate: 2020-01-15T17:08:56.437Z
Answers.UserDisplayName: Chris Burgess
Answers.Body: <p>I often use 3rd party mailing services (namely mailgun, mandrill but have used others too). You can pay these services <em>a lot</em> to keep all your mail for a while, but the sheer amount of it will always be an issue if you're looking to capture every single mail that goes out.</p>
  
  <p>I have implemented an exim4 configuration that keeps a copy in a local Maildir at times when I've been paranoid and wanted to see exactly what goes out (e.g. check placeholder replacements). This has benefits in that it's on your own server so you can easily do what you want with it: search it, delete it, compress it (or store it on a compressed filesystem, e.g. btrfs offers this option), access it using MUAs or webmail (if you configure it right), store it somewhere affordable - e.g. (<a href="https://www.bytemark.co.uk/prices/#cloud-prices" rel="nofollow noreferrer">Bytemark</a> give you 100GB storage for £2/mo and their cheapest VM is £6/mo).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-16T09:39:36.583Z
Answers.LastActivityDate: 2020-01-16T09:39:36.583Z
Answers.UserDisplayName: artfulrobot
Answers.Body: <p>From an admin (non-sysadmin) perspective, the extension <a href="https://lab.civicrm.org/extensions/invoicehelper" rel="nofollow noreferrer">invoicehelper</a> has options to automatically cc/bcc specific emails, notably for offline membership/contribution emails.</p>
  
  <p>It does not handle the simple "Send Email" form, however. And one thing I get asked often, is that when viewing emails sent (activities), it should display who was CC'ed/BCC'ed. For example, if a membership invoice was sent to an organization and CC a specific contact, it's an important bit of information for tracking down late payments.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-15T16:39:40.187Z
Answers.LastActivityDate: 2020-01-15T16:39:40.187Z
Answers.UserDisplayName: bgm
Answers.Body: <p>With a bit of development you could probably put something together using <a href="https://lab.civicrm.org/extensions/mailreader" rel="nofollow noreferrer">https://lab.civicrm.org/extensions/mailreader</a> as the UI</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-16T16:20:08.123Z
Answers.LastActivityDate: 2020-01-16T16:20:08.123Z
Answers.UserDisplayName: Matthew Wire
Answers.Body: <p>Another option if it needs to be accessible to staffers is an extension that instead of auto-adding a bcc to all emails, logs them as an activity of some new type. Then either in the same extension or via something like <a href="https://github.com/JMAConsulting/biz.jmaconsulting.activitytypeacl" rel="nofollow noreferrer">https://github.com/JMAConsulting/biz.jmaconsulting.activitytypeacl</a>, restrict viewing those activities to admins. It might have similar performance issues as file logging on a busy site.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-16T09:42:11.420Z
Answers.Text: I'd note that CiviCRM gets difficult if you have a lot of activities (I once had a 40GB activitty table!). You can claw back some performance by using InnoDB's COMPRESS ROW\_FORMAT since this sort of thing compresses well (a lot of repetition)
Answers.UserDisplayName: artfulrobot
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-15T16:58:23.047Z
Answers.LastActivityDate: 2020-01-15T16:58:23.047Z
Answers.UserDisplayName: Demerit
Body: <p>What solutions are people using to track all outbound email from CiviCRM?</p>
  
  <p>BCCing would be one option - a BCC could be added to all outbound email via an extension, I suppose.</p>
  
  <p>Else I'm guessing that some Third Party ESPs might also provide this functionality.</p>
  
  <p>Interested to know what people are doing / if there are any solutions I haven't thought of.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-15T13:22:05.960Z
Comments.Text: Not really an answer (I think) but we're using a third party ESP that logs all outgoing emails.
Comments.UserDisplayName: HomoTechsual
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-15T17:18:45.093Z
Comments.Text: My question to the client would be whether it's sufficient to keep a smaller sample of the emails. Eg if the concern is with delivery to a given email provider(s), creating an account on that/those provider(s) and subscribing the address(es) would give you a confirmation of delivery without the privacy, performance and other implications.
Comments.UserDisplayName: Chris Burgess
Tags: <civimail><email>
Title: Log all outbound email
ThreadText: # Log all outbound email
  
  (Asked by: username_0 on 2020-01-15)
  
  What solutions are people using to track all outbound email from CiviCRM?
  
  BCCing would be one option - a BCC could be added to all outbound email via an extension, I suppose.
  
  Else I'm guessing that some Third Party ESPs might also provide this functionality.
  
  Interested to know what people are doing / if there are any solutions I haven't thought of.
  
  **Tags:** civimail, email
  
  > **Comments:**
  > **username_1**: Not really an answer (I think) but we're using a third party ESP that logs all outgoing emails.  
  > **username_2**: My question to the client would be whether it's sufficient to keep a smaller sample of the emails. Eg if the concern is with delivery to a given email provider(s), creating an account on that/those provider(s) and subscribing the address(es) would give you a confirmation of delivery without the privacy, performance and other implications.  
  
  ---
  
  ## 7 answers
  
  ### Answer by username_3 on 2020-01-17. Score: 2 | Accepted answer
  
  You could look at the [Transactional Mail](https://civicrm.org/extensions/transactional-emails) extension which ensures everything going out from eg Sch Reminders, Receipts etc are stored as Activities on the contact
  
  > **Comments:**
  > **username_0**: Lots of great answers to think about and reflect on. In the end, I think this is the one that best meets the client needs :)  
  > **username_3**: good to know it is of use  
  
  ---
  
  ### Answer by username_4 on 2020-01-15. Score: 4
  
  In civicrm.settings.php there's some settings to log it all to a file. See <https://docs.civicrm.org/dev/en/latest/tools/debugging/#changing-file-based-settings>
  
  ```
  define('CIVICRM_MAIL_LOG', '/file/path');
  define('CIVICRM_MAIL_LOG_AND_SEND', 1);
  
  ```
  
  > **Comments:**
  > **username_5**: Thats gonna get pretty huge if your sending a lot of emails. Our approach is to use the sending gateways logging/audit processes. Although they do not normally keep for more than 14 days or so, some do. I guess the real question is what are objectives of keeping the logs?  
  > **username_0**: thanks @username_4 - I didn't know about CIVICRM_MAIL_LOG_AND_SEND.  
  > **username_0**: @username_5 - good question. The client had a bad experience sending mail from civicrm in the past and wants to keep an eye on what is being sent. Hence needs to be client user friendly.  
  > **username_6**: Was the bad experience with the design/look and feel of the emails or the deliverability?  
  > **username_0**: Good question. Not 100%. My hunch was deliverability and just not being sure of what was getting sent, what each email contained, etc.  
  
  ---
  
  ### Answer by username_2 on 2020-01-15. Score: 2
  
  If it's your current MTA, Postfix has an option to BCC all emails to an address: `always_bcc`
  
  * <https://stackoverflow.com/questions/1491552/i-would-like-to-add-a-bcc-to-all-mails-going-out-from-my-postfix#1491586>
  * <http://www.postfix.org/ADDRESS_REWRITING_README.html>
  
  More complex solutions can be implemented.
  
  > **Comments:**
  > **username_2**: Any debug methods which use SMTP may have impact on your civimail, eg if you debug by sending many emails to a single mailbox at a given mail provider, this might affect your spam reputation with them.  
  
  ---
  
  ### Answer by username_7 on 2020-01-16. Score: 2
  
  I often use 3rd party mailing services (namely mailgun, mandrill but have used others too). You can pay these services *a lot* to keep all your mail for a while, but the sheer amount of it will always be an issue if you're looking to capture every single mail that goes out.
  
  I have implemented an exim4 configuration that keeps a copy in a local Maildir at times when I've been paranoid and wanted to see exactly what goes out (e.g. check placeholder replacements). This has benefits in that it's on your own server so you can easily do what you want with it: search it, delete it, compress it (or store it on a compressed filesystem, e.g. btrfs offers this option), access it using MUAs or webmail (if you configure it right), store it somewhere affordable - e.g. ([Bytemark](https://www.bytemark.co.uk/prices/#cloud-prices) give you 100GB storage for £2/mo and their cheapest VM is £6/mo).
  
  
  ---
  
  ### Answer by username_8 on 2020-01-15. Score: 2
  
  From an admin (non-sysadmin) perspective, the extension [invoicehelper](https://lab.civicrm.org/extensions/invoicehelper) has options to automatically cc/bcc specific emails, notably for offline membership/contribution emails.
  
  It does not handle the simple "Send Email" form, however. And one thing I get asked often, is that when viewing emails sent (activities), it should display who was CC'ed/BCC'ed. For example, if a membership invoice was sent to an organization and CC a specific contact, it's an important bit of information for tracking down late payments.
  
  
  ---
  
  ### Answer by username_9 on 2020-01-16. Score: 1
  
  With a bit of development you could probably put something together using <https://lab.civicrm.org/extensions/mailreader> as the UI
  
  
  ---
  
  ### Answer by username_4 on 2020-01-15. Score: 0
  
  Another option if it needs to be accessible to staffers is an extension that instead of auto-adding a bcc to all emails, logs them as an activity of some new type. Then either in the same extension or via something like <https://github.com/JMAConsulting/biz.jmaconsulting.activitytypeacl>, restrict viewing those activities to admins. It might have similar performance issues as file logging on a busy site.
  
  > **Comments:**
  > **username_7**: I'd note that CiviCRM gets difficult if you have a lot of activities (I once had a 40GB activitty table!). You can claw back some performance by using InnoDB's COMPRESS ROW\_FORMAT since this sort of thing compresses well (a lot of repetition)  
  
  ---
  
  