I encountered a problem when trying to send attachments with "Archive a copy of this message on this website" unchecked.

A few details about our system:
Temporary file path is set to /tmp
Default download method is private

Users with ability to send mass contact messages also have the "Send arbitrary files" permission associated to their role.

Despite having the above permission we were still encountering problems sending attachments. I have created the following patch against 7.x-1.0 that changes the _mass_contact_process_mime_mail_attachments method addition to the file array for files that are not stored for archival purposes. It removes the filepath and uri properties from the $files array entry in favor of a filecontent property that contains the contents of the file referenced.

I hope this fix helps out others and makes its way into 7.x-1.x-dev for an upcoming release. I'd really like to see this implemented in 1.1 as to not have to re-patch this file when the update is available.

Thanks a million!

Comments

dasginganinja’s picture

dasginganinja’s picture

If a patch needs to be rolled against 7.x-1.x let me know and I can provide it.

dasginganinja’s picture

Issue summary: View changes
arkestra’s picture

This patch works wonderfully. Could this be added to the dev branch, if not already there?

Thanks!

anybody’s picture

Priority: Normal » Critical
StatusFileSize
new1.24 KB

Here's the final patch that works for saved AND unsaved mass messages. Both have to be changed to fix this issue completely.

I tested it and I'm using the fix in production.

Please RTBC and create a new stable release. File uploads are currently NOT WORKING at all.

oadaeh’s picture

Assigned: dasginganinja » Unassigned
Status: Active » Postponed (maintainer needs more info)

In testing this, I was not able to reproduce the problem. I was able to send and save attachments in every configuration format I tried. Is there a specific configuration setting where this manifests?

The patches fundamentally change the way attachments are set up for use with Mime Mail. Did your testing include sending mail with Mime Mail?

Also, have you tried with Mass Contact 7.x-1.1, as that is the current version?

oadaeh’s picture

I marked #2733421: Attachment destroyed to 1kb file as a duplicate of this issue.

oadaeh’s picture

I marked #2727903: Format error with attachments as a duplicate of this issue.

oadaeh’s picture

divcg’s picture

I have also just experienced this issue. I needed to use the patch that was provided here and it worked perfectly to solve the issue of 1k broken attachments that only contained the tmp file URL as content. I have the Mime Mail module enabled as required. I am currently running Drupal 7.43 (will be updating shortly). I had no special setups and just installed this module. Does not matter if I had create node checked or unchecked I still got 1k attachments

anybody’s picture

@divcg: Thanks a lot for your feedback. Could you please tell us which patch (#) you used and which module versions (mimemail, mass contact) you are using? That way oadaeh may reproduce this. We should really fix this or find a solution.

oadaeh’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Priority: Critical » Major

@Anybody, would you please try making a modification to your submitted patch and test it to see if things still work for you? The change is simply to leave the lines you removed in place and only add the one you added. If that change still works for you, I'll commit it. Thanks.
Also, which version of Mass Contact are you using?

anybody’s picture

Yes, that works for me, thank you. Lets hope it works for all of us :)

anybody’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community

  • oadaeh committed ee7084b on 7.x-1.x authored by Anybody
    Issue #2423647 by dasginganinja, Anybody, oadaeh, arkestra, divcg:...
oadaeh’s picture

I committed the patch to the 7.x-1.x branch with a modification to avoid triplicate calls to drupal_realpath().
I'm going to leave this open for now, to see that it fixes the problem for everyone and doesn't haven any side effects.
Once I am confident all is okay, I'll close this and tag a new release.
Thanks everyone.

oadaeh’s picture

Status: Reviewed & tested by the community » Fixed

Since there has been no further discussion, I'm marking this fixed.

anybody’s picture

Thank you , works perfectly.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rickj’s picture

I've just discovered that this patch as submitted doesn't work (first time I've actually needed to send an attachment).

The code in patch #5 works fine, but the committed version with the original lines in place doesn't. It creates what looks like the correct attachment, but the content is the URL of the file, not the file contents.

I'm using Mail System 7.x-2.35 and Mime Mail 7.x-1.1+11-dev. I'm guessing from the dates above that this was originally tested with Mime Mail 7.x-1.0. Have the Mime Mail updates affected the behaviour?