Developer Support »

Getting blank, unreadable attachments  (See more user questions)

>I'm honestly confused now because it's working internally this morning as
>well. I really have NO idea what I changed to make it work, but it is so I
>am happy!
>It may have been that I made the correct fix in php settings or iis settings
>along the way, but the service didn't refresh until after hours last night.
> In any case, sorry for the false alarm -and- the fact that I can't tell you
>what it was that got it working in the end.
>Just for informational purposes, I'm viewing the messages in Outlook 2007,
>as well as webmail and it works in both places.
>Thanks again,
Good stuff, .

I was also thinking, it might be the client you use to read the email.
Might have a problem with that encoding I mentioned (not that I've heard of it before). Do you use a different
email program on your home computer to to your work computer? You could try
it on the system at work with a webmail address, just to see.

Best wishes.

Charles Sweeney
The world's easiest feedback script!

----- Original Message -----
Sent: Wednesday, June 16, 2010 1:04 AM
Subject: Re: FormToEmail-Pro script

> Hi Charles,
> Well thanks for all the help, strangely enough I tested from a home
> computer
> and it worked perfectly! Must have something to do with the fact that I
> was
> sending it from a system on the same domain as the mail server or
> something
> along those lines. In any case, it doesn't matter if it doesn't work
> internally so all is well.
> Thanks again,

> On Tue, Jun 15, 2010 at 6:41 PM,
> wrote:
>> Beats me for now, . I pretty much rely on everything on the
>> customer's
>> server being sweet.
>> I sent a test file to you "test.txt". This is what I got in your print
>> out:
>> File: Resource id #2D:\WEBSITES\Temp\phpA503.tmp
>> FILESIZE: 9Data: Data2: Array0: --boundary_sdfsfsdfs345345sfsgs
>> Content-Type: text/plain; name="test.txt" Content-Disposition:
>> attachment;
>> filename="test.txt" Content-Transfer-Encoding: base64 Array1:
>> Thank you
>> Your message has been sent
>> Click here to continue
>> --boundary_sdfsfsdfs345345sfsgs Content-Type: text/plain; name="test.txt"
>> Content-Disposition: attachment; filename="test.txt"
>> Content-Transfer-Encoding: base64
>> D:\WEBSITES\\php/--boundary_sdfsfsdfs345345sfsgs
>> Content-Type: text/plain; charset="iso-8859-1" Submit: Submit Test:
>> test.txt
>> Sender's IP address: Date submitted: June 15th, 2010.
>> 06:16
>> pm --boundary_sdfsfsdfs345345sfsgs Content-Type: text/plain;
>> name="test.txt"
>> Content-Disposition: attachment; filename="test.txt"
>> Content-Transfer-Encoding: base64 --boundary_sdfsfsdfs345345sfsgs
>> Content-Type: text/plain; charset="iso-8859-1" name="form_data.csv"
>> Content-Disposition: attachment; filename="form_data.csv"
>> submit,test,Sender's IP address,Date submitted
>> Submit,test.txt,,"June 15th, 2010. 06:16 pm"
>> --boundary_sdfsfsdfs345345sfsgs--
>> The fact you are getting the CSV attachment tells me that things are
>> mostly
>> ok. I'm trying to think what is the difference between that and a file
>> uploaded from the form. I'm leaning towards the encoding used to
>> transmit
>> uploaded files, as per this line in the script (line 1635 in your script,
>> there's two instances of it, one for the stock email and one for
>> attaching a
>> file to the autoresponse):
>> $data = chunk_split(base64_encode($data));
>> Check you have the chunk_split() and base64_encode() functions on your
>> PHP.
>> You would get an error if they didn't work. Check your error log.
>> In fact, just to experiment, try commenting-out that line, like so:
>> //$data = chunk_split(base64_encode($data));
>> ...then try it with a very small file again.
>> It's late here (UK) but I'll leave that with you for now.
>> Best wishes.
>> Charles Sweeney
>> The world's easiest feedback script!
>> ----- Original Message ----- From:
>> To: ""
>> Sent: Tuesday, June 15, 2010 11:01 PM
>> Subject: Re: FormToEmail-Pro script
>> Thanks again,
>>> I recreated the test page without any validation errors and still no
>>> joy.
>>> The other problem is, I am the host. It could be a problem with
>>> PHP/IIS7
>>> configuration, however I imagine you would have seen this problem many
>>> times
>>> before if that were the case. I can't imagine there's any problem at
>>> the
>>> Exchange server level since email is all working well, attachments are
>>> being
>>> attached and there is nothing in quarantine or anything like that.
>>> I tried moving the temp location and changing permissions, but no
>>> change.
>>> Started printing out varables because I'm running out of ideas and
>>> noticed
>>> $_SERVER['DOCUMENT_ROOT'] is D:\WEBSITES\ which does not
>>> seem
>>> right.
>>> Just throwing anything I can think of out there. If you try the page
>>> again
>>> you will see I am printing a bunch of vars just to get a handle on it.
>>> On Tue, Jun 15, 2010 at 4:40 PM, <
>>> >wrote:
>>> Hi .
>>>> Thanks for the additional info.
>>>> Pretty much everything looks in order.
>>>> The fact you are getting the CSV attachment and can upload a file to
>>>> the
>>>> server rules a lot of things out.
>>>> I don't think it's a permissions issue, particularly since you can
>>>> upload
>>>> a
>>>> file to the server.
>>>> The uploaded temp file is stored in the specified temp folder in your
>>>> PHP
>>>> settings, which can be anywhere.
>>>> Just one thing. You have got validation errors on the form page:
>>>> I would get rid of those. Even just make a simple test form with ONLY
>>>> the
>>>> form code on it. Try that and let me know how it goes.
>>>> The only other thing I can think of is to ask the host about it.
>>>> Best wishes.
>>>> Charles Sweeney
>>>> The world's easiest feedback script!
>>>> ----- Original Message ----- From:
>>>> >
>>>> To: "" <>
>>>> Sent: Tuesday, June 15, 2010 8:31 PM
>>>> Subject: Re: FormToEmail-Pro script
>>>> Hi again,
>>>>> I'll try to give as much detail as possible this time. I realized
>>>>> after
>>>>> I
>>>>> sent the message that it would probably be useless without a lot more
>>>>> info.
>>>>> The size limits I was referring to are the "upload_max_filesize" and
>>>>> "post_max_size" which I have set to '20M' for now. The files I am
>>>>> testing
>>>>> with are much smaller. I did not set a max size at the script level.
>>>>> I tried a test page with the following code:
>>>>> <form action="php/formtoemailpro.php" method="post"
>>>>> enctype="multipart/form-data">
>>>>> <input type="file" name="test">
>>>>> <input type="submit" name="submit">
>>>>> </form>
>>>>> Even a 4Kb text file (1 word) comes through as 200B. I was able to
>>>>> open
>>>>> the
>>>>> text file but there was no content.
>>>>> I am using PHP on IIS7. PHP is using my Exchange server for SMTP.
>>>>> There
>>>>> is
>>>>> no issue actually receiving mail, and if I am not using a file input,
>>>>> it
>>>>> works as intended. In fact, using the upload to server option works,
>>>>> and
>>>>> if
>>>>> I use the attach csv option, THAT file comes through OK as an
>>>>> attachment.
>>>>> I have not set an allow value for file types on the form input or in
>>>>> the
>>>>> script. I have set blocked file types: $file_types_to_block =
>>>>> array('.com','.bat','.exe','.zip','.rar','.php'); however turning the
>>>>> option
>>>>> off does not change anything.
>>>>> Could it be a permissions issue? Where is the uploaded temp file
>>>>> stored
>>>>> before attaching to the email?
>>>>> The test page is here:
>>>>> The script is attached.
>>>>> Thanks again for your time. It's likely something really simple, but
>>>>> I
>>>>> am
>>>>> at a loss.
>>>>> On Tue, Jun 15, 2010 at 12:59 PM,
>>>>> <
>>>>> >wrote:
>>>>> Hi .
>>>>>> Thank you for your purchase. Good to hear from you.
>>>>>> There's nothing in the script that would cause that. When you say
>>>>>> you
>>>>>> set
>>>>>> size limits, did you do this in the script or on your PHP setup?
>>>>>> Better
>>>>>> initially not to set a size limit in the script, this will then allow
>>>>>> files
>>>>>> of any size, which you can test with.
>>>>>> It might be your connection, your ISP, your host, your email server,
>>>>>> your
>>>>>> email service. I can't tell about those. All I can tell you is the
>>>>>> script
>>>>>> isn't fussy. It will attach and send any attachment. Just a point,
>>>>>> make
>>>>>> sure there aren't any validation errors on the form. If need be just
>>>>>> make a
>>>>>> simple test form on a new page.
>>>>>> Have you tried it with small files? Make a very small text file,
>>>>>> with
>>>>>> just
>>>>>> one word "test" in it. Does that come through OK?
>>>>>> Can you try it on a different host? Try it on a different email
>>>>>> address
>>>>>> too (not unheard of for email services to block large attachments).
>>>>>> What type of file are you trying to upload? Have you configured the
>>>>>> script
>>>>>> to restrict attachments to any particular type??
>>>>>> If you are still having a problem, my first port of call would be the
>>>>>> host,
>>>>>> but there's a lot of potential problem areas between your computer
>>>>>> and
>>>>>> it
>>>>>> finally arriving in your inbox.
>>>>>> If you give me the URL of your form page and attach your edited
>>>>>> script,
>>>>>> I
>>>>>> will have a look at them (for what it's worth).
>>>>>> Best wishes.
>>>>>> Charles Sweeney
>>>>>> The world's easiest feedback script!
>>>>>> ----- Original Message ----- From: <>
>>>>>> To: <>
>>>>>> Sent: Tuesday, June 15, 2010 5:33 PM
>>>>>> Subject: FormToEmail script
>>>>>>> Comments: Hi,
>>>>>>> I just purchased your script and am in the process of configuring
>>>>>>> it.
>>>>>>> I
>>>>>>> was having issues getting email attachments to appear, so I checked
>>>>>>> the
>>>>>>> support site. Now that I have added the correct enctype to the
>>>>>>> html,
>>>>>>> the
>>>>>>> attachments are being added to the email, however they are corrupted
>>>>>>> or
>>>>>>> not
>>>>>>> readable. I have checked the php configuration and set the upload
>>>>>>> limits
>>>>>>> nice and high to ensure that is not the issue. The problem is,
>>>>>>> attaching a
>>>>>>> 200-500K file results in an attachment of 200-500B and thus is
>>>>>>> unreadable.
>>>>>>> Have you encountered this before? Any suggestions to troubleshoot?