TMSFNCCloudMicrosoftOutlookMail embedded/inline images

Hi,

Currently we are trying to use the TMSFNCCloudMicrosoftOutlookMail to send e-mails from our application. Thus far we are able to send plain text mails and html mails without embedded/inline images.
When an email body has an inline image, they are not shown/attached in the sent e-mail.
We have tried all kinds of options, but seem to miss something essential while our attachments are not added to the mail.

fyi: the mail body is composed using a TAdvRichEditor.
Before we used a TAdvRichEditorMiniHTMLIO and TIdMessageBuilderHtml to send using Indy, but we are trying to replace this with TMSFNCCloudMicrosoftOutlookMail

afbeelding

Alex

Hi,

  • Please note that some email clients do not have support to display embedded images. Can you please specify which email client you are using? Does the issue only happen in a specific email client or in different ones?

  • Does using embedded images work as expected when using TIdMessageBuilderHtml?

Hi @Bart,

The probleem doesnt seem client related. We tried Outlook (windows client and webclient) as well as Thunderbird.

We were able to narrow down the main part of problem to the function TTMSFNCCustomCloudMicrosoftOutlookMail.GetMailData from VCL.TMSFNCCloudMicrosoftOutlookMail. In this function files are always just added as attachment, without the option to set them "inline". A small modification resulted in us being able to get inline images, however this is not yet a permanent sollution:

  if Assigned(AFiles) then
  begin
    for I := 0 to AFiles.Count - 1 do
    begin
      if I > 0 then
        files := files + ', ';

      data := TTMSFNCUtils.FileToBase64(AFiles[I].&File);

      files := files
        + ' {'
        + ' "@odata.type": "#microsoft.graph.fileAttachment",'
        //+ ' "name": "' + ExtractFileNameEx(AFiles[I].&File) + '",'
        // Hardcode file/image name for now, so it corresponds to the name in de HTML Body 
        + ' "name": "data-image47png-sha1-7F33731D652C5933FA3326CE21719A3CEEBF4DD8",'
        + ' "contentType": "' + GetMimeTypeEx(AFiles[I].&File) + '",'
        + ' "isInline": true,' // <-- NEEDED FOR INLINE IMAGES IN HTML MAILS
        + ' "contentBytes": "' + data + '"'
        + ' }';
    end;

Using this code we were able to use a separate file as inline image. We are still trying to work out how to get the inline images from the TIdMessageBuilderHtml added in the email (without saving them to disc first). Seems to be very hard since sending the messages only works with TTMSFNCCloudMicrosoftOutlookMailFiles (and nothing can be done with TTMSFNCCloudMicrosoftOutlookMailAttachments for sending emails)
afbeelding

Hi,

Thank you for your suggestion. We'll have to investigate if this change can be added in a future version of TMS FNC Cloud Pack.

Please note that TTMSFNCCloudMicrosoftOutlookMailAttachments is currently only intended to be used when downloading attachments of received mails and not for sending mails.

Hi @Bart, thanks for your reply. We will be monitoring possible updates on this subject, since a couple of our customers highly want/need this feature.

Alex