Repository navigation
Update MailKit step template to version 2 - #1720
Open
harrisonmeister wants to merge 1 commit into
Open
harrisonmeister wants to merge 1 commit into
harrisonmeister wants to merge 1 commit into
Conversation
Updated the MailKit step template to version 2, modifying the required packages to include MimeKit.Core instead of MimeKit. Adjusted the script body for compatibility with the new package structure and improved parameter handling.
|
Review this PR in Hyponome for a side-by-side diff of the step-template JSON and any embedded scripts. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
MimeKit and MailKit 5.0.0 broke the Send Email using MailKit step in three ways:
MimeKitis now a meta-package with no assemblies. The library code moved toMimeKit.Core(andMimeKit.Cryptography), so the hardcoded pathlib/netstandard2.1/MimeKit.dllno longer exists andAdd-Typefails.netstandard2.1target folder, which isn't guaranteed to exist in every package version.SmtpClient.Send(MimeMessage)was removed. MailKit 5 expectsSend(ISendRequest, CancellationToken)and returns aSendResult.The step also picked up whatever version of each package was installed first, so a worker could end up loading MimeKit 4.x alongside MailKit 5.x.
Results
MimeKit.CoreandMailKitinstead of theMimeKitmeta-package.5.0.0). A new optional parameter,SendEmail.MailKitVersion, overrides it.libfolder for the PowerShell runtime (netX.0up to the runtime version, thennetstandard2.1, thennetstandard2.0) instead of hardcoding one. If nothing fits, the error lists the folders that do exist.Get-Packagenow filters by-ProviderName NuGetand-RequiredVersion, so stale or unrelated packages on the worker aren't used.[MailKit.SendRequest]::new($Message), logs the server response at verbose level and warns about rejected recipients.finallyblock so it's cleaned up when sending fails.MimeKit.Core.Before
Loading MimeKit:
Sending (after working around the load failure):
After
Pre-requisites
Idshould be a GUID that is not00000000-0000-0000-0000-000000000000Idproperty (updating theIdwill break the Library sync functionality in Octopus).Versionshould be incremented, otherwise the integration with Octopus won't update the step template correctly$Metamust haveExportedAtandOctopusVersionupdated$LastModifiedByfield must be present, and (optionally) updated with the correct author