FluentEmail icon indicating copy to clipboard operation
FluentEmail copied to clipboard

Inline images in SendGridSender

Open Chakrygin opened this issue 3 years ago • 1 comments

Hi!

I`m trying to send email containing images using SendGridSender. But the images are not displayed in gmail and some other web cleints.

The raw SendGridClient supports the Disposition property (https://github.com/sendgrid/sendgrid-csharp/blob/main/src/SendGrid/Helpers/Mail/Model/Attachment.cs#L34-L38), which works fine. Unfortunately this property is not used in SendGridSender. And the IsInline property is not used at all.

Maybe this method should use the property like this? https://github.com/lukencode/FluentEmail/blob/master/src/Senders/FluentEmail.SendGrid/SendGridSender.cs#L141-L146

        private async Task<SendGridAttachment> ConvertAttachment(Core.Models.Attachment attachment) => new SendGridAttachment
        {
            Content = await GetAttachmentBase64String(attachment.Data),
            Filename = attachment.Filename,
            Type = attachment.ContentType,
            Disposition = attachment.IsInline ? "inline" : "attachment",
        };

Chakrygin avatar Dec 27 '21 13:12 Chakrygin

@lukencode I am willing to fix this issue with PR, but I wonder if you will approve it? One more thing missing here is ContentId

crowz4k avatar Jan 14 '23 11:01 crowz4k