Skip to content

Commit 0d6a494

Browse files
authored
✨ feat: add support for inline images (#169)
* Update GraphSender.cs Set missing FileAttachement and AttachementItem properties from Core.Models.Attachment * Fixed typo in GraphSender.cs
1 parent fe8ed11 commit 0d6a494

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/FluentEmail.Graph/GraphSender.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,14 @@ private async Task UploadAttachmentUnder3Mb(IFluentEmail email, Message draft, C
130130
{
131131
var attachment = new FileAttachment
132132
{
133-
Name = a.Filename, ContentType = a.ContentType, ContentBytes = GetAttachmentBytes(a.Data),
133+
Name = a.Filename,
134+
ContentType = a.ContentType,
135+
ContentBytes = GetAttachmentBytes(a.Data),
136+
ContentId = a.ContentId,
137+
IsInline = a.IsInline,
138+
139+
// can never be bigger than 3MB, so it is safe to cast to int
140+
Size = (int)a.Data.Length,
134141
};
135142

136143
await this.graphClient.Users[email.Data.FromAddress.EmailAddress]
@@ -146,7 +153,12 @@ private async Task UploadAttachment3MbOrOver(
146153
{
147154
var attachmentItem = new AttachmentItem
148155
{
149-
AttachmentType = AttachmentType.File, Name = attachment.Filename, Size = attachment.Data.Length,
156+
AttachmentType = AttachmentType.File,
157+
Name = attachment.Filename,
158+
Size = attachment.Data.Length,
159+
ContentType = attachment.ContentType,
160+
ContentId = attachment.ContentId,
161+
IsInline = attachment.IsInline,
150162
};
151163

152164
var uploadSession = await this.graphClient.Users[email.Data.FromAddress.EmailAddress]

0 commit comments

Comments
 (0)