Attachments - Corrupted Files

Hi there, i noticed that sending emails from Outlook 2007 with attachments, creates notes in right way but only text file are correctly downloadable.

Jpg images or PDF files are corrupted.

See images-31.jpg (right image) and images-31 (1).jpg (corrupted one)

Thank you for highlighting this. We will investigate, test and push out a fix for this bug.



1 Like

Sorry to resurrect an old thread but was a patch for this ever pushed? We are experiencing the same issues, again with Outlook 2007.



Hi Sam,

There was no updated outlook plugin released as yet, but we plan to release this soon and I will update the thread once released.



Sorry to beat a dead horse Will, I couldn’t see the issue on Git and was wondering if it had only been reported for 2007 or was known to occur in other versions, I would just like to know that if I recommend my clients move to a later version of Outlook the problem is unlikely to persist.

Thanks again for your time.

Hello, this issue occurs because plugin base64 encodes attachements with spaces instead of “+”.
for example:

“asdklhgisjkhfo asdpjadhsi aidhsiasuhd”

It should be:


PHP base64_decode then missreads string with spaces.

Workaraound in SuiteCRM: go to modules/notes/NoteSoap.php find


add after:

$note['file'] = str_replace(" ",'+', $note['file']);

Going to try this first thing tomorrow, just wanted to say thanks in advance, if this is the fix I have been looking for I owe you big time. :cheer:

No problem, tell me if it worked. :slight_smile:

Does not appear to have worked unfortunately, I will look into this more thoroughly in the future though. Thanks.

Worked for me when I changed to the following;

$note[‘file’] = str_replace(’ ‘,’+’, $note[‘file’]);

in both functions;


Thanks Axe.

Should have been;

$note['file'] =  str_replace(' ','+', $note['file']);

cut n paste did something

After Tien reported back with success I went and had a look and we found an issue with our server config, sorted it, re-implemented the fix and it all appears to be working, thanks a lot.

Might be worthwhile making sure someone from the Suite team sees this and the fix is shipped with the next patch.

Thanks again, this is a life saver.

Have the same problem: attachments corrupted
Can I download the correct version (patch) or can somebody give me info what I must change in which files on sugar files


Hi guys,

Can i please confirm the exact change I need to make in the NoteSoap.php file?

The standard code reads -

            if(empty($focus->id)) {
                return '-1';

Do i need to change it to read -

    if(!empty($note['file'] =  str_replace(' ','+', $note['file']);
            if(empty($focus->id)) {
                return '-1';

If not, can someone please confirm the correct code?

Finally, does the correct code need to be entered onto lines 62 (function saveFile) and 100 (function newSaveFile) only?



Hi Tien,

Can you please clarify the exact code we need to use and on which lines of the standard NoteSoap.php file?

Axe, hoping you could provide some guidance to the questions I posted a couple of days ago?


modules/notes/NoteSoap.php find string:
add after that:

$note[‘file’] = str_replace(’ ‘,’+’, $note[‘file’]);

Apply in both functions:


Can you please confirm if you used the following text - " if(!empty($note[‘file’])){$note[‘file’] = str_replace(’ ‘,’+’, $note[‘file’]); "?
or did you use " if(!empty($note[‘file’] = str_replace(’ ‘,’+’, $note[‘file’]); "?


Hi Axe, I believe I have made the correct changes to my notesoap.php file but the attachments are still not copying across into Suite. Are you able to check the attached file and confirm that my changes are in fact correct?