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
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?
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)
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.
Hello, has there been anymore headway on this? This is exactly what I am trying to do. We used to use an internal Exchange server, and we are using a TMSFNCRichEditor for writing custom email messages. However, when we used to send our emails before, we were using the HTMLIO component to save a temporary cached version of the message, with InlineImages set to False. Then I would manipulate the HTML to change the path of the images, and place them on our file server, and modify the link in the email to point there. Now we are moving to Office 365, and that no longer functions as needed. We now need to embed the images directly in the email. So I'm wondering if there has been any more progress on this ticket?
Thank you!
Unfortunately there has been no progress on this request, as we haven't received any further requests for this particular feature up till now.
We'll have to investigate if there is a possibility to add this feature in a future version.