xyj70 / fusionpbx

Automatically exported from code.google.com/p/fusionpbx
0 stars 0 forks source link

Wav file attachments don't open in Thunderbird #203

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Setup Voicemail to email
2. Leave a message
3. Try to open wav file in thunderbird

Problem:
Fusion is setting the content type in the email as:
Content-Type: wav; name="msg_foo.wav"

Solution:
Change the mime type to:
Content-Type: audio/wav; name="msg_foo.wav"

Verification:
find a message in Thunderbird and select View->Source.  Save the source file as 
msg.eml.  Double click the file (in windows), and you won't be able to open the 
attached wav file.  Edit msg.eml (wordpad/etc) and change the Content-Type to 
audio/wav.  You can now open wav attachment in msg.eml.

those using mp3's probably need the same fix.  Also unsure as to how this 
affects (or doesn't) other mail clients like outlook.

Original issue reported on code.google.com by James.O....@gmail.com on 29 Nov 2011 at 4:39

GoogleCodeExporter commented 9 years ago
Here's a patch that works.  Probably best to figure out why $content_type is 
not returning properly in the add attachments.  It is doing so correctly in the 
stanza below (verified by logging)

//get the body
     $body = '';
     foreach($decoded[0]["Parts"] as $row) {
             $content_type = $row['Headers']['content-type:'];

/secure/v_mailto.php

//add an attachment
+                               if ($file_ext == "wav") {
+                                       $file_ext = "audio/x-wav";
+                               }
+                               else if ($file_ext == "mp3") {
+                                       $file_ext = "audio/x-mp3";
+                               }
$mail->AddStringAttachment($parts_array["Body"],$file,$encoding,$file_ext);
                        }
                }
AddStringAttachment expects mime-type for the last argument, not file_ext...

Original comment by James.O....@gmail.com on 29 Nov 2011 at 5:40

GoogleCodeExporter commented 9 years ago
Ah missed that on the recent major change to the mailto php page. Thanks for 
pointing this out with a working solution.

Original comment by markjcrane@gmail.com on 30 Nov 2011 at 6:52