Answers.Body: <p>This does not exist in the UI currently. However, it does seem like a good idea to have a script that deletes OR archives mailings that are greater than N months / years old. So i'd recommend writing a api job that does the needful.</p>
  
  <p>Approx steps would be:</p>
  
  <p>a. Create a new delete/archive mailing job taking parameters like list of ids or mailing delivered before date XXX</p>
  
  <p>b. Check and ensure that the mailing delete api deletes all the right tables. Most of the deletion is done by mysql via cascaded relationships. At a quick glance, the api delete does not seem to handle file attachments</p>
  
  <p>c. Use the API from item b to implement the scheduled job</p>
  
  <p>Please do share your extension so others can benefit</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-12T17:19:22.917Z
Answers.Text: Good idea, i was thinking about this and worried about what might break.
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-13T21:25:02.707Z
Answers.Text: An extension to do exactly this is here: https://github.com/jitendrapurohit/nz.co.fuzion.deleteoldbulkmailings
  Thanks jitendra!
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-02T18:36:35.377Z
Answers.Text: Oh, good find @AlanDixon! I'm going to test that extension. Perhaps they can make an official release soon.
Answers.UserDisplayName: herb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-12T04:00:25.133Z
Answers.LastActivityDate: 2015-06-13T01:17:29.797Z
Answers.LastEditDate: 2015-06-13T01:17:29.797Z
Answers.UserDisplayName: Donald Lobo
Answers.Body: <p>You can try this extension <strong>Delete Old Bulk Mailings for CiviCRM</strong> (<a href="https://github.com/jitendrapurohit/nz.co.fuzion.deleteoldbulkmailings" rel="nofollow noreferrer">https://github.com/jitendrapurohit/nz.co.fuzion.deleteoldbulkmailings</a>) which provides some new API calls.</p>
  
  <p>You can either use the API in a script or you can use the command line tool <strong>cv</strong> (<a href="https://github.com/civicrm/cv" rel="nofollow noreferrer">https://github.com/civicrm/cv</a>). The README provides some good examples on how to use it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-02T18:58:59.657Z
Answers.LastActivityDate: 2019-10-02T18:58:59.657Z
Answers.UserDisplayName: herb
Answers.Body: <p>I don't think it is likely that old mailings would cause troubles with sending a CiviMail. They would use up disk space which would likely manifest other problems when disk space ran low or was exhausted. </p>
  
  <p>It's more likely that a problem sending a mass mailing is due to growth in your list size, and that sending to more recipients is causing your server to run out of memory. Can you describe the symptoms of the problems you are having when sending?</p>
  
  <p>It's still going to be a good idea to create ways to deal conveniently with continual growth of disk space by old mailings.</p>
  
  <p>If it turns out the issue is RAM usage for sending CiviMails, then you can tune the throttling of sending. </p>
  
  <p>Certain email integrations may also be implemented to send a CiviMail by sending a single email for delivery to a synchronised list held on an external server, which would offload from your CiviCRM server virtually all of the load of sending. But I'm not confident about this. It's not true of our Mandrill extension but could be true of the MailChimp or Constant Contact ones. I don't think it is true of the CiviSMTP service.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-02T17:14:12.167Z
Answers.Text: Here's a caveat: a client is getting timeout errors when trying to schedule a mailing, let alone sending the mailing. So this isn't about sending but (I think) with the size of the recipient table and the size of the group. This is where removing old mailings can help.
Answers.UserDisplayName: herb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-13T20:55:31.887Z
Answers.LastActivityDate: 2015-06-13T20:55:31.887Z
Answers.UserDisplayName: Joe Murray
Answers.Body: <p>I like this idea. For reference, one of my bigger installs has the following sizes of the 4 biggest files in mysql (in MB). So removing the corresponding activities (or maybe only some of the associations) is probably a good idea also.</p>
  
  <pre><code>110592  civicrm_mailing_event_delivered.ibd
  151552  civicrm_mailing_recipients.ibd
  188420  civicrm_activity_contact.ibd
  266240  civicrm_mailing_event_queue.ibd
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-23T21:38:32.323Z
Answers.Text: Did you get anywhere with this?
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-12T17:23:12.187Z
Answers.LastActivityDate: 2015-06-12T17:23:12.187Z
Answers.UserDisplayName: Alan Dixon
Body: <p>DB has grown so huge and it started to cause problems with sending mass mailings. I want to delete old mass mailings, the sent ones and the drafts, etc. Is there away to do it in one click instead of deleting each and everyone individually? </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-12T11:12:08.453Z
Comments.Text: How many mailings/what's the size? Are you sure it's the cause of the issue?
Comments.UserDisplayName: Xavier
Tags: <civimail>
Title: Mass Deleting Scheduled and Sent Mailings, Drafts, etc
ThreadText: # Mass Deleting Scheduled and Sent Mailings, Drafts, etc
  
  (Asked by: username_0 on 2015-06-11)
  
  DB has grown so huge and it started to cause problems with sending mass mailings. I want to delete old mass mailings, the sent ones and the drafts, etc. Is there away to do it in one click instead of deleting each and everyone individually?
  
  **Tags:** civimail
  
  > **Comments:**
  > **username_1**: How many mailings/what's the size? Are you sure it's the cause of the issue?  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_2 on 2015-06-12. Score: 7 | Accepted answer
  
  This does not exist in the UI currently. However, it does seem like a good idea to have a script that deletes OR archives mailings that are greater than N months / years old. So i'd recommend writing a api job that does the needful.
  
  Approx steps would be:
  
  a. Create a new delete/archive mailing job taking parameters like list of ids or mailing delivered before date XXX
  
  b. Check and ensure that the mailing delete api deletes all the right tables. Most of the deletion is done by mysql via cascaded relationships. At a quick glance, the api delete does not seem to handle file attachments
  
  c. Use the API from item b to implement the scheduled job
  
  Please do share your extension so others can benefit
  
  > **Comments:**
  > **username_3**: Good idea, i was thinking about this and worried about what might break.  
  > **username_3**: An extension to do exactly this is here: https://github.com/jitendrapurohit/nz.co.username_6.deleteoldbulkmailings Thanks jitendra!  
  > **username_4**: Oh, good find @username_3! I'm going to test that extension. Perhaps they can make an official release soon.  
  
  ---
  
  ### Answer by username_4 on 2019-10-02. Score: 3
  
  You can try this extension **Delete Old Bulk Mailings for CiviCRM** (<https://github.com/jitendrapurohit/nz.co.username_6.deleteoldbulkmailings>) which provides some new API calls.
  
  You can either use the API in a script or you can use the command line tool **cv** (<https://github.com/civicrm/cv>). The README provides some good examples on how to use it.
  
  
  ---
  
  ### Answer by username_5 on 2015-06-13. Score: 1
  
  I don't think it is likely that old mailings would cause troubles with sending a CiviMail. They would use up disk space which would likely manifest other problems when disk space ran low or was exhausted.
  
  It's more likely that a problem sending a mass mailing is due to growth in your list size, and that sending to more recipients is causing your server to run out of memory. Can you describe the symptoms of the problems you are having when sending?
  
  It's still going to be a good idea to create ways to deal conveniently with continual growth of disk space by old mailings.
  
  If it turns out the issue is RAM usage for sending CiviMails, then you can tune the throttling of sending.
  
  Certain email integrations may also be implemented to send a CiviMail by sending a single email for delivery to a synchronised list held on an external server, which would offload from your CiviCRM server virtually all of the load of sending. But I'm not confident about this. It's not true of our Mandrill extension but could be true of the MailChimp or Constant Contact ones. I don't think it is true of the CiviSMTP service.
  
  > **Comments:**
  > **username_4**: Here's a caveat: a client is getting timeout errors when trying to schedule a mailing, let alone sending the mailing. So this isn't about sending but (I think) with the size of the recipient table and the size of the group. This is where removing old mailings can help.  
  
  ---
  
  ### Answer by username_3 on 2015-06-12. Score: 0
  
  I like this idea. For reference, one of my bigger installs has the following sizes of the 4 biggest files in mysql (in MB). So removing the corresponding activities (or maybe only some of the associations) is probably a good idea also.
  
  ```
  110592  civicrm_mailing_event_delivered.ibd
  151552  civicrm_mailing_recipients.ibd
  188420  civicrm_activity_contact.ibd
  266240  civicrm_mailing_event_queue.ibd
  
  ```
  
  > **Comments:**
  > **username_6**: Did you get anywhere with this?  
  
  ---
  
  