1

I want to remove the ability to add attachments. Particularly, it should not be used for CiviMail as it's a great way to hurt email reputation and is simply unnecessary. I would rather load into my CMS media library and then add it into CiviMail via a hyperlink or image. I suppose I could argue that this option shouldn't even exist in CiviMail.

In Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.) there are two options for attachments.

Maximum Attachments

Maximum Attachments For Backend Processes

Does Maximum Attachments mean only for front end forms?

To prevent attachments from being used, I set both to 0. I also tried to set this with an override in civicrm.settings.php but it does not accept a 0, so I tried -1 and that 'save right' but still had no effect.

What are those settings effecting then if not CiviMail? How can I remove attachment functionality? My last resort is removing the option thru a tpl.extra. I would prefer not to do that and fix it at the source.

1

I think how these options work

Maximum Attachments

This options is used to build number of attachment on offline forms like Sending Email in the form activities etc. Till now its handled on All email forms, Note, Activity, Campaign and Grant. Setting 0 means no attachment field on all those forms.

Maximum Attachments For Backend Processes

This options is used to process number of files can be saved in the system. This are handled in Note, Activity, Campaign and Grant. Setting this option will limit the number of attachment stored for the entity. Setting 0 means no files will be stored in database or system. This option will restrict sending while sending email as an activity. However the same option is used to restrict files when saving Mailing(will work incase mailing created via api or cloned) but the UI forms explicitly calls separate function to attach files where this setting option is not respected till now.

There is also no UI setting to hide the attachment tab for Mailings so its down to customization. You can do this by one of the following method

  1. Hide using css

code:

form[name='crmMailing'] li[aria-controls='tab-attachment'] {
    display: none;
}
  1. Hide/remove using JS

code:

$("form[name='crmMailing'] li[aria-controls='tab-attachment']").remove(); 
OR 
$("form[name='crmMailing'] li[aria-controls='tab-attachment']").hide();
  1. Remove the Attachment tab using hook_civicrm_alterAngulars()

  2. Remove attachment while sending email using hook_civicrm_alterMailParams()

HTH

Pradeep

| improve this answer | |
1

I don't think either of those settings would help prevent attachments for mailings. The first one the help text says "Maximum number of files (documents, images, etc.) which can be attached to emails or activities. This setting applies to UI forms and limits the number of fields available on the form." Setting it to 0 does remove the attachments field from activities, but the setting's not used I guess for mailings.

The second setting won't help. It's for things like the inbound email processor and is just a sanity/denial-of-service prevention limit.

I think this would need to be a customization.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.