Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send-EmailMessage: More Flexible Attachments and Linked Resources #19

Open
Viajaz opened this issue Sep 3, 2021 · 2 comments
Open

Send-EmailMessage: More Flexible Attachments and Linked Resources #19

Viajaz opened this issue Sep 3, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@Viajaz
Copy link

Viajaz commented Sep 3, 2021

The ability to have more flexible attachments (other than just specifying path) would be useful.

The easiest way to do this is to change the $Attachment Parameter to [object[]] type and rely on MimeKit.AttachmentCollection.Add() which supports both Strings and MimeEntity

Although this doesn't really help with LinkedResources for things like changing changing attachment meta-data, such as Content-Disposition and Content-Id which is required for inline images in HTML emails in some emails. Perhaps LinkedResources can be exposed as a parameter too? Could be a number of ways to implement this as a more polished easy-to-use solution, maybe a separate -InlineAttachments Parameter that handles both?

https://www.mimekit.net/docs/html/Creating-Messages.htm#UsingBodyBuilder

@Viajaz
Copy link
Author

Viajaz commented Sep 3, 2021

Quick and dirty idea if one doesn't want to deal with MimeUtils.GenerateMessageId handling

if ($InlineAttachments) {
	foreach ($A in $InlineAttachments) {
		$LR = $BodyBuilder.LinkedResources.Add($A)
		$LR.ContentId = Split-Path -Path $A -Leaf
	}
}

@PrzemyslawKlys
Copy link
Member

Care for a PR? Having inlineattachments is required, especially if I want to support the same thing as PSWriteHTML module have for sending emails.

@PrzemyslawKlys PrzemyslawKlys added the enhancement New feature or request label Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants