Skip to content

Commit 87441ae

Browse files
committed
fix: Email.AttachFromFilename does not dispose stream
closes #23
1 parent 8a24d6d commit 87441ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/FluentEmail.Core/Email.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ public IFluentEmail Attach(IEnumerable<Attachment> attachments)
461461

462462
public IFluentEmail AttachFromFilename(string filename, string contentType = null, string attachmentName = null)
463463
{
464-
var stream = File.OpenRead(filename);
464+
var stream = new MemoryStream(File.ReadAllBytes(filename));
465465
Attach(new Attachment
466466
{
467467
Data = stream,

0 commit comments

Comments
 (0)