PDA

View Full Version : Solution: File attachments fixed


Ebonhand
12-30-2007, 10:43 AM
Hi Everyone,

I did some in-depth analysis to find out what was going wrong with the file attachment process

Using the supplied api_exit() function to generate diagnostic emails, I was able to systematically narrow down the problem.

Turns out that the script as-written only accepts "parts" with either no "disposition" ($part->disposition), or a disposition equal to "attachment".

This excluded the other common way of including files in an email, which is a disposition of "inline" (mainly used for images)

I modified line 105 in /api/pipe.php :
if($part->disposition && !strcasecmp($part->disposition,'attachment')) {
to read:
if(($part->disposition) && (!strcasecmp($part->disposition,'attachment') ||
(!strcasecmp($part->disposition,'inline')))) {

This seemed to fix the problem on my test case (inline-attached image)

I've not yet conducted in-depth testing with other file types (as it's nearly 2am here), but no doubt this will be a good start for anyone curious as to why file attachments aren't working in some/all cases.

Kind regards,
Ebonhand

peter
12-30-2007, 10:47 AM
For RC2 I have the code as follows;

if($part->disposition && (!strcasecmp($part->disposition,'attachment') || !strcasecmp($part->ctype_primary,'image')))

Ebonhand
12-30-2007, 10:53 AM
For RC2 I have the code as follows;

Any ideas when RC2 will be available? I'd much prefer to hack on the latest code than have to patch afterwards!

At least in the meantime we can use attached images :)

Kind regards,
Ebonhand

peter
12-30-2007, 11:02 AM
I hope to get it out sometimes today.

red
01-16-2008, 10:32 AM
I replaced the code that peter posted with ebonhand's fix but I still get the error
Invalid upload dir
Directory must be valid and writeable

the directory is set to 777

any ideas?

4ice
01-16-2008, 11:22 AM
Hi Red,

are you sure you have the path right?
In my case I created a folder "ost_attachments" inside the scp folder, in the Admin Panel I only entered "ost_attachments" (so no path) and it's working fine.

And this is the normal RC2 version.
I replaced the code that peter posted with ebonhand's fix but I still get the error
Invalid upload dir
Directory must be valid and writeable

the directory is set to 777

any ideas?

red
01-17-2008, 10:32 AM
OK, putting it in the scp folder worked
Thanks!

bignose
01-24-2008, 01:06 PM
Hi,

Attachments still don't work here, running 1.6 RC2, here are the error messages I get. I was testing emailing a jpg from Apple mail. I've turned on email attachments, picked the correct path etc.

Bounce from email program:

----
his message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

pipe to |/usr/home/suite210/public_html/support/api/pipe.php
generated by isupport@suite2101.com
(ultimately generated from support@interchange.ca)
local delivery failed

------ This is a copy of the message, including all the headers. ------
------ The body of the message is 193930 characters long; only the first
------ 106496 or so are included here.
-----

And from the mail logs:

2008-01-24 11:44:36 1JI5Bp-000EkN-G3 ** |/usr/home/suite210/public_html/support/api/pipe.php (isupport@suite2101.com) <support@interchange.ca> R=virtual_aliases_nostar T=virtual_address_pipe: Child process
of virtual_address_pipe transport returned 65 (could mean error in input data) from command: /usr/home/suite210/public_html/support/api/pipe.php
2008-01-24 11:44:36 1JI5Bs-000Ekd-BR <= <> R=1JI5Bp-000EkN-G3 U=mailnull P=local S=108195
2008-01-24 11:44:36 1JI5Bp-000EkN-G3 Completed
----------------

Idea's?

Jeff.

salazar.ea
08-18-2008, 12:00 AM
OK, putting it in the scp folder worked
Thanks!

Hi, Yes, thanks for the clue. Placing the Attachments folder inside the SCP directory works fine. One only needs to enter the folder name in the Attachments Folder: field in Admin panel.

irperera
08-20-2008, 09:29 PM
anyone have this with iis, i need to know how to get my attachments to work with iis