Hello,

users of our website complained that mass contact attachments were not readable. After doing some tests I found that the files were base64 encoded.
It seems most of the mail clients can not handle this type of encoding. I am for example using Outlook 2003.

I am not sure if this is a bug or a feature, but if regular users can not access attachments I would say attachments are not usable.

Here the beginning of how the attachments look like:

Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="2009 California Cup Schedule
(Black&White).pdf"

JVBERi0xLjQKJcfsj6IKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAzIDAgUi9QYWdlTGF5
b3V0L09uZUNvbHVtbi9PcGVuQWN0aW9uWzQgMCBSL0ZpdF0+PgplbmRvYmoKMiAwIG9iajw8L1By
b2R1Y2VyKEJsdWViZWFtIEJyZXdlcnkgNS4wKS9DcmVhdGlvbkRhdGUoRDoyMDA5MDEyOTIzMTky
...

Thanks,
Ulf

Comments

sharplesa’s picture

Status: Postponed (maintainer needs more info) » Active

Are you also using the "HTML Mail" module? My testing shows that Mass Contact and HTML Mail are incompatible. HTML Mail doubles up on the markup that is sent in the email.

I've found that by turning off the "HTML Mail" module, I get attachments that look right.

Under the hood, what's happening is that, after Mass Contact finishes crafting the email message, it calls drupal_mail, which calls drupal_alter, allowing all other modules that affect email to mess around with the information before it gets sent.

sharplesa’s picture

Status: Active » Postponed (maintainer needs more info)
ulf1’s picture

Status: Active » Closed (fixed)

Sorry for replying so late, but I did not signup for notifications.

I do not use "html mail" module.

However, after grepping for mail_alter I found that mail_logger (I use Mail Logger 6.x-1.0) causes the mail changes

I will ask the Mail Logger maintainer for help.

Thanks,
Ulf

strgpune’s picture

Hi,
I am facing similar problem. Below is the result at Outlook as well as gmail side-
--0c90faa4d8695d22aa144faa6e812921 Content-Type: text/plain; charset=UTF-8; format=flowed; Hi I am the one, who is 100% fit for this job. --0c90faa4d8695d22aa144faa6e812921 Content-Type: application/msword; name="attitudew97.doc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="foo.doc" 0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAACAAAAlQAAAAAAAAAA EAAAlwAAAAEAAAD+////AAAAAJMAAACUAAAA////////////////////////////////////////

I am using mime module to handle messages. Can you please advice how the problem could be resolved?

scubasmurf’s picture

+1

tom_gustav’s picture

Category: bug » support
Status: Closed (fixed) » Active

My users can't use the mass contact forms with attachments. The attachment is transformed in
something else (Content-Transfer-Encoding: base64).
I searched through the fora to no avail.
Could someone help me?

oadaeh’s picture

Are you using the latest version? If not, try the 6.x-1.0 version. If so, try the 6.x-1.x-dev version, which is slightly newer.

tom_gustav’s picture

yes, I'm using the 6.x-1.x-dev version. Sending a message without attachment goes well. If I send a message with attachment two things seem to happen:

(i) I'm getting the folllowing message:

"This is a MIME-formatted multipart message.

If you see this text it means that your e-mail software does not support MIME-formatted multipart messages.

You might want to consider changing your e-mail software to one that understands how to properly display MIME-formatted multipart messages.

--2b9fb3b7f0bafc4ec8c79ca273fbbab5
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
"

(ii) the attachment is transformed in some kinf of code (base 64 ?):

"-2b9fb3b7f0bafc4ec8c79ca273fbbab5
Content-Type: application/pdf; name="Bovenaanzicht-1 (1).pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Bovenaanzicht-1 (1).pdf"

JVBERi0xLjMNJf////8NMSAwIG9iag08PA0vVGl0bGUgKP7/AFcAaQBuAG4AZQByACAAZQB4AHAA
bwByAHQALwBwAHIAaQBuAHQAaQBuAGcpDS9Qcm9kdWNlciAoQW15dW5pIFBERiBDb252ZXJ0ZXIg
dmVyc2lvbiAzLjAzKQ0vQ3JlYXRpb25EYXRlIChEOjIwMTAwNTE2MTk0NjE1KzAyJzAwJykNPj4N
ZW5kb2JqDTcg ......"

oadaeh’s picture

Version: 6.x-1.0-beta2 » 6.x-1.x-dev

The attachments are supposed to be converted to base64 (or something similar) before transmitting. Otherwise, no mail server will accept the message. That is not the problem. The problem is that some other module is altering the message in such a way that the receiving client cannot properly decode it. Check what other mail modules are installed and see if any of them are modifying the messages on the way out. You can do what ulf1 said in comment #3 and search your contrib modules for the mail_alter function.

oadaeh’s picture

Status: Active » Postponed (maintainer needs more info)
tom_gustav’s picture

I'm not using any other mail modules, so comment #3 does not apply.

tom_gustav’s picture

I emptied my cache, I de-installed and re-installed the mass contact module. Now everything seems to work fine. Strange... but I'm happy.

oadaeh’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Excellent.