1. David Peace (Powersoft)
  2. PowerBuilder
  3. Tuesday, 21 November 2023 11:59 AM UTC

Hi All

We have converted a clients appliaction to use the new SMTPClient to send emails. They work fine on our environment but in their network the email is being wrapped within another email. This is the explanation we got from their IT.

I believe this issue is caused by the way the source application streams the attachment into the email. We have seen this once before, the issue was resolved at source by changing the way the file was attached to the email.

From what I can remember, it was either Trend (our email security appliance) or Office365 had to nest the streamed attachments in order to scan and present the mail correctly as the attachment was base64 encoded and streamed into the email body rather than being attached normally.

I’m pretty sure the fix for the previous issue was to not base64 encode and stream.

We can see in the email headers that the attachment is indeed base64 encoded into the email body*, we can also see that the email passes through our SMTP server fine and then reaches Trend**.

My suggestion would be to work with the provider to find an alternative attachment process

 

Anyone got any thoughts, I belive we have always used Base64 encoding for attachments and assume that PB is doing the same. There are no parameters on the addattachment that might give us otpions on this.

Thanks in advance.

David

Accepted Answer
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Friday, 8 December 2023 12:23 PM UTC
  2. PowerBuilder
  3. # Permalink

I found the problem, the old MAPI routine was sending a blank email with the attachment. Clearly the Email client was sorting out the blank message.

When sending via SMTP the file could not be encoded into the body of the message which was "null" so it ended up being wrapped in the email. Adding a single space to the message body resolved the problem.

Thanks for all your help.

 

Comment
There are no comments made yet.
Ken Guo @Appeon Accepted Answer Pending Moderation
  1. Thursday, 23 November 2023 06:38 AM UTC
  2. PowerBuilder
  3. # 1

Hi David,

 

It is common for attachments to use base64 encoding. If the email is being wrapped within another email, could you ask your email provider or Trend if they can provide a cause or log or even a solution?

 

To better keep track of this problem, can you submit a ticket to our support system at https://www.appeon.com/standardsupport/newbug?

 I would also need you to send an email separately from MS Outlook and PB STMPClient, with the same attachment and recipient. Then save the 2 emails you receive as *.msg files and upload them for us to analyze.

 

Regards,

Ken

Comment
  1. David Peace (Powersoft)
  2. Thursday, 23 November 2023 15:27 PM UTC
Thanks Ken

I have raised Bug 11222 - SMTPClient File Attachment Method

This has the two email .MSG files you requested. I have requested more information about the systems that are not happy with base64 encoding.
  1. Helpful
There are no comments made yet.
Ken Guo @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 22 November 2023 08:51 AM UTC
  2. PowerBuilder
  3. # 2

Hi David,

 

To better understand this problem, can you share with us how you handled it when you ran into this problem previously?

Since you mentioned that the problem was resolved at source by changing the way the file was attached to the email when you ran into this problem before, can you share with us how you changed the code of the email attachment to solve this problem?

 

Regards,

Ken

Comment
  1. David Peace (Powersoft)
  2. Wednesday, 22 November 2023 09:40 AM UTC
Hi Ken

With regards to the existing PB application we are converting from MAPI to SMTP. We are using "addattachment" method to add a file attachment. The existing MAPI solution works fine. The SMTP solution also works fine with a simple SMTP server architecture. The client is routine these outbound emails through AntiVirus and it is that solution which is changing the emails structure.



Where the client is talking about the changes made to a previous system they are not referring to one of our nor was it PowerBuilder.



I have looked back at the old tech we used for SMTP and it also used base64 encoding to add attachments,so I'm not quite sure what they are talking about, in my simple understanding Emails are plain text and you need some sort of encoding to embed binary files. SO I'm not sure how they want the email attachments to be embedded that is different?
  1. Helpful
  1. Simon Jutzi
  2. Wednesday, 22 November 2023 10:19 AM UTC
The original email format was plain text only.

Today, emails are sent as mime multipart and you can define various parts in different encoding/format.

More Infos about it: https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html



There are a lot of pitfalls when it comes to reliably implementing SMTP (e.g. correct line endings, max line length, html transforming, ...).

Can you get some information out of their antivirus solution? Usually, there should be a log file.
  1. Helpful
  1. David Peace (Powersoft)
  2. Wednesday, 22 November 2023 14:52 PM UTC
  1. Helpful
There are no comments made yet.
Simon Jutzi Accepted Answer Pending Moderation
  1. Tuesday, 21 November 2023 20:26 PM UTC
  2. PowerBuilder
  3. # 3

Hi David

Do you mean attachments or embedded assets like pictures?
Because for the latter, we found out, that some mail clients/transfer agents do not like uri data embedding in HTML.

<img src="data:image/png;base64,APfqhjhe==" alt="Base64 embedded image" />

For the former, I can say that we do attach files in Base64 encoding in our own SMTPClient implementation without any issues.

Regards Simon

Comment
  1. David Peace (Powersoft)
  2. Wednesday, 22 November 2023 09:50 AM UTC
We are attaching files using the "addattachment" method in the new SMTPClient message. The files we are attaching are excel & PDF files. For some reason the clients antivirus solution is then wrapping the outbound message in a new message. They are using these messages to communicate with external systems which cannot read the multilayered messages. I must admit that we have always used base64 encoding to send messages so I am not sure what other method they are suggesting is more appropriate. I do not understand what the mean by "being attached normally"
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.