Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In structure/Contact Forms, I can make forms that have fields in them. But these forms don't seem to be able to mail to all users on my site. The page Mass Contact uses does not seem to be one of these forms, and I see no way of attaching anything. I also tried using Full HTML insert a picture in the body, but this is stripped when the mail is sent. The allowed HTML tags seem to be those of Restricted HTML (the default), even when I change the type to Full HTML in the Mass Contact message pane.
Comment | File | Size | Author |
---|---|---|---|
#5 | mass_contact-attachments-3018920-5.patch | 9.54 KB | embeau |
Comments
Comment #2
manishsaharan CreditAttribution: manishsaharan commentedNow I can easily send attachments of file of type [csv, xlsx, xlx, jpg, jpeg, png, txt].
Comment #4
tjtj CreditAttribution: tjtj commentedYou do need to install Mimemail to get this to work, even on Drupal 8.7. And you should add pdf, doc, docx to the patch list of allowed files.
Comment #5
embeau CreditAttribution: embeau at Aptitude Digital commentedI tried manishsaharan29497's patch, but it wasn't working for me and didn't include all the features I required.
So I took manishsaharan29497's patch as a starting point and built off of that to create a new patch with a few more features.
First, I updated the Email body settings page (found at /admin/config/mass-contact/settings/body) to include an Attachments area. Here, the user is able to input via the UI the upload destination (public or private), the file directory, the allowed file extensions, and the max upload size.
Then, I updated the mass contact form itself. I allow for multiple file attachments and validate the size and extension.
Upon submitting the form, I loop through the array of attached files to get the necessary data for each to send along with the rest of the message.
I left some todos in EmailBodyForm.php regarding validation of the user input for the various settings. If anyone has some guidance on how to go about doing this, please let me know.
Comment #6
gaurav.kapoor CreditAttribution: gaurav.kapoor at Axelerant for Drupal India Association commentedComment #7
gaurav.kapoor CreditAttribution: gaurav.kapoor at Axelerant for Drupal India Association commented@embeau and @manishsaharan29497 thanks for working on this feature. The patch will require slight modifications, testing, and some of the tests will have to be changed as well.
I will work on this issue.