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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tjtj created an issue. See original summary.

manishsaharan’s picture

Status: Active » Needs review
FileSize
3.32 KB

Now I can easily send attachments of file of type [csv, xlsx, xlx, jpg, jpeg, png, txt].

Status: Needs review » Needs work

The last submitted patch, 2: mass_contact-3018920-1.patch, failed testing. View results

tjtj’s picture

You 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.

embeau’s picture

Version: 8.x-1.x-dev » 8.x-1.0-beta2
Component: Documentation » Code
Category: Support request » Feature request
FileSize
9.54 KB

I 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.

gaurav.kapoor’s picture

Status: Needs work » Needs review
gaurav.kapoor’s picture

Assigned: Unassigned » gaurav.kapoor

@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.