Manual import mail with mail (.msg) as attachment failed

Hi @all

I have a mail in a group mailbox that I want to import manually. So far this has worked well, but not with this one Mail. The special feature is that it has a mail as attachment.
If I want to import the mail, I only see this error message: Database error. Please have a look at the file suitecrm.log.

If images or PDF or Office documents or tables are attached, it is no problem.
Only for mail attachments.

The log of the import is attached.

Greetings Polymed

The mail is simply too big for the database. If it had a normal attachment or inline images, it would be stored in separate files, so it would work.

But with a huge mail-as-attachment, SuiteCRM tries to save it all as the Email body, and the database errors out.

I think SuiteCRM could probably recognize this case and handle it differently (saving an .eml file as an attachment), or at least give a more appropriate error, or truncate the email body before attempting to store it. But you would have to open an issue on Github for this and hope that somebody can develop these enhancements…

Actually having a second look I see what is too long is the “description” field in the “notes” table. So SuiteCRM is correctly creating a separate file for this but for some reason uses a huge string for the description?

:huh:

I don’t know, I don’t know. That’s possible.
How can this be influenced?
Can this be fixed in the database itself?

I think it needs to be fixed in the Note creation code to truncate the description.

It can also be fixed in the Email importing code to choose a better way of saving the description of an email.

Can you provide the actual email that causes this? Or is it something private? In this case you could try creating a similar one. It would really help to be able to reproduce the problem.

Hello

According to company policy I am not allowed to send any internal mail to anywhere.
But I create print screens in a first step and attach them here.

Main Mail:

Attached mail (Zomm size reduced to 30% and the scrollbar is only at a bit more than half):

Do you think the contents are too big?
From the main mail this can’t be because only about 50 lines of pure text.
But from the attached mail it is. The text is big and has many pictures embedded in the mail.

Greetings

I understand that you can’t share the email, but for me I would need a way to see this in action, it’s hard to reproduce (with limited time to devote).

If you can come up with a non-private email that exhibits this issue, I ask if you can please open a new issue for it in Github so it can be fixed. Thanks for reporting.

Hi pgr

I was just able to test it, and I think you can follow the test.

I opened a mail and inserted 100 paragraphs (not words) of the “Lorem ipusm dolor” - Text.
Then the same text in a second mail and the second mail just attached normally.
Then I wanted to import the mail in SuiteCRM manual and then: voila, same error message.
It seems to be the content size.

So it seems to be a bug.
I have to see how it works with Github…

Greetings

I’ve been looking at the code and I think you are running an old version of SuiteCRM, are you? Or a new one, but from the oldest branches (7.8 perhaps)?

I am not sure, but this is probably where you should trim it:

https://github.com/salesagility/SuiteCRM/blob/hotfix-7.8.x/modules/InboundEmail/InboundEmail.php#L3691

but that code is not even present there in the newest versions…

Hi

Thanks for the info.
We have version 7.11.2 (Sugar version 6.5.25).

Then I’ll take a look at the update. This is done by somebody external, and he is here again at the beginning of August.

But I look into the code and your hyperlink

Thanks and greetings polymed.

Tested again. The error only occurs if someone has attached a mail as an attachment to the mail. Only then.

@pgr: do you think this is a bug?

On 7.11.6? Did you upgrade?

So finally I got to upgrade the CRM version 7.11.8.
Unfortunately the problem didn’t get any better but even worse.
Since it is a little complicated, I have processed it in a PDF and attach it here.

Greetings Sam / Polymed

Thanks for the complete report!

Please remind me, do you have a GitHub issue open for this bug? Which one?

Hi pgr

I hadn’t done that yet.
Already now: https://github.com/salesagility/SuiteCRM/issues/7887

Greetings

1 Like