1

I have a SAP HCI scenario where I send in the end an email with a XML response attached. I get this error although the file has 20kb size and it has only one receiver.

com.sun.mail.smtp.SMTPSendFailedException: 552 5.3.4 Header size exceeds fixed maximum size

3
  • 1) What is the SMTP server -- cloud or on-prem? 2) Have you tried sent the similar letter to this SMTP using groovy script from HCI? Nov 2, 2017 at 14:50
  • 1
    What exactly is the fixed maximum size? JavaMail adds very few headers that aren't a direct result of methods you call, so you have a fair amount of control over the size of the headers. And if you need more control you can subclass MimeMessage. Nov 2, 2017 at 21:29
  • @BillShannon the javamail tag here is by mistake, for my opinion Nov 3, 2017 at 12:13

1 Answer 1

1

Ok, I understood it:

CPI-PI SMTP adapter configuration

It's SMTP adapter channel-specific configuration. By design developer must choose source of an attachments and headers the only good choice (not properties, that's pity).

All the headers of CPI message are transfered to SMTP (bad design for me), so your limitation occurs due either specified attachment or any other header.

For proving my hypothesis, I created two headers: aa with small length and ab with long text:

msg.setHeader('aa', "<?xml version='1.0'?><root>" + "a"*256 + "</root>")
msg.setHeader('ab', "<?xml version='1.0'?><root>" + "a"*1024*30 + "</root>")

Then, I posted the message into cloud-internal SMTP, and received bounce message:

This message was created automatically by the SMTP relay on XXXXXXXXXXXXXXXX.

A message that you sent could not be delivered to all of its recipients.
The following address(es) failed:

  ilya.kuznetsov@domain
    SMTP error from remote mail server after MAIL FROM:<ilya.kuznetsov@domain> SIZE=4019:
    host XXXXXXXXXXXX [1.1.1.1]: 550 Administrative prohibition 2017-11-03-121-56439fc44a7dc0b43c28074ed7efe877

------ This is a copy of the message, including all the headers. ------

Return-path: <ilya.kuznetsov@domain>
...
Date: Fri, 3 Nov 2017 12:00:20 +0000 (UTC)
From: ilya.kuznetsov@domain
To: ilya.kuznetsov@domain
Subject: Hello world 2017-11-03T12:00:19.019Z
MIME-Version: 1.0
Content-Type: multipart/mixed; 
    boundary="----=_Part_69_482225443.1509710419985"
aa: <?xml version='1.0'?><root>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</root>
SAP_MessageProcessingLogID: AFn8WlOMHKwYXS0KJbCcva0BG9Wh
SAP_MplCorrelationId: AFn8WlOmx_9yZFXocsPbBYIjesC9
SAP_PregeneratedMplId: AFn8WlPK-r5wMnCqVPDM-nHhsvmo
scriptFile: stackoverflow_47077818.groovy
scriptFileType: groovy

------=_Part_69_482225443.1509710419985
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Hello world body
------=_Part_69_482225443.1509710419985
Content-Type: application/xml; name=aa
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=aa

<?xml version='1.0'?><root>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</root>
------=_Part_69_482225443.1509710419985--

So, as you can see, unrelated headers which are not used for the letter, transfered during SMTP session and they could be the reason of your error.

The better way is to use simple Groovy script with plain Javamail code.

1
  • Yes unfortunatelly it works like this. I also used the body and removed other headers to be able to use the mail adapter. It's also a problem with the headers when you're making a webservice call so during the scenario we should stick to exchange properties. Nov 7, 2017 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.