• Blog
  • Contact
  • About
Menu

The PowerShell Bear

I'm here to help you!
  • Blog
  • Contact
  • About
Fancy v1.0 scratched out, 0.9.0 hand written and scratched out for 0.9.1, beta1 handwritten and scratched out for beta2

Almost there…

"PoshMailKit" version 0.9.1-beta2 published to Gallery

March 14, 2022

I've published the beta of PoshMailKit (0.9.1-beta2). You can install and try it out using this command:

Install-Module -Name PoshMailKit -AllowPrerelease

Or, you can check it out on GitHub.

Rename

Name badge saying "Hello my name is" with the name field filled with question marks
Who is that masked man...

As mentioned in my update of my last post, I had to change the name of the project because I discovered that somebody had already taken the name in the PowerShell Gallery a couple years ago and pretty much immediately abandoned and delisted it. While I like that old name a bit better, this one with work just as well.

What works

Rubik's cube solved, yellow green and orange sides showing
Feels good getting that solved

I've gotten the following implemented in Send-MKMailMessage, which will all work identically to their counterparts in the old SmtpClient based Send-MailMessage:

  • To, Cc, and Bcc, all with multiple recipients support
  • Basic parameters: Subject, From, Body, SmtpServer, Port
  • BodyAsHtml
  • Attachments
  • Priority
    • Note: as the Send-MailMessage version relies on a System.Net.Mail based Enum, I've recreated the enum with the same options, but they don't translate directly to the proper priorities in MailKit
    • The names in MailKit's version of the Enum (MailKit.MessagePriority) are the actual names that the protocol uses:
      • Normal is still Normal
      • High is Urgent
      • Low is NonUrgent
    • This parameter is included for legacy support so it can work as a drop-in replacement as intended

Additionally, I've included the following parameters that aren't found in Send-MailMessage:

  • MessagePriority
    • This is the replacement parameter for Priority using the MailKit.MessagePriority enum directly; note that -Priority is really just translating to what this parameter takes, and it otherwise functions identically under the hood
    • This parameter and the legacy -Priority parameter are mutually exclusive
    • Using -Priority or -MessagePriority will put the cmdlet into Legacy or Modern mode (respectively) and are mutually exclusive; currently this only affects these parameters, but other parameters will also get modern counterparts that will behave differently (and, arguably, better, or at least more "correctly")
  • InlineAttachments
    • This allows you to include labeled attachments that you can use with an HTML body
    • It takes a hashtable consisting of \<label data-preserve-html-node="true"-name> = \<path data-preserve-html-node="true"-to-file>
    • I'm not giving examples of how to use it just yet but plan to include some with the 1.0 release; that said, without going into details or a full example, you can call the attachment by adding src='cid:<label-name>' to the appropriate tag

Finally, it supports positional parameters and takes them the same way Send-MailMessage does. I would have preferred to make some changes to them because it's kind of weird that you're required to include the -From parameter but it's not positional, so at the very end you have to add one named parameter, but it is what it is; I doubt many people are really using it this way anyway.

What doesn't (but will for 1.0)

Rubik's cube, disassembled and laying in pieces
Don't worry, it'll fit together

The following are the (currently identified) things I need to add before I'll be willing to declare this project at 1.0 status:

  • ReplyTo
  • Delivery notifications
  • Encoding options
  • SSL
  • Authentication credentials
  • Parameter aliases to match Send-MailMessage
  • Documentation and help files

Open to help

While I doubt anyone's going to jump in to help with this, at least not until (and unless) it becomes popular/well-known/in-use enough, if anyone is interested, I'd be open to entertaining pull requests addressing outstanding issues, or even just people adding issues to request features or report bugs.

Hopefully it won't be too long before I have it ready for a 1.0 release.

Image attribution

See links to origin sites for proper attribution to creators

  • Rubik's Cube
  • Disassembled Rubik's Cube

The rest I made myself (poorly)

Source: https://www.powershellgallery.com/packages...
In Projects Tags PoshMailKit, MailKit, Send-MKMailMessage, Send-MailMessage, Module, C#, SMTP, SmtpClient, Announcement
← "PoshMailKit" Release version 1.1.0 published to GalleryNew project announcement: "PoshMailKit" →

Latest Posts

Blog
Using Visual Studio Code Syntax highlighting to make PowerShell better
about 3 years ago
"PoshMailKit" Release version 1.1.0 published to Gallery
about 3 years ago
"PoshMailKit" version 0.9.1-beta2 published to Gallery
about 3 years ago
New project announcement: "PoshMailKit"
about 3 years ago
Change Report: 2021
about 4 years ago

Fresh Tweets

Whatever it is, the way you tell your story online can make all the difference.
  • #PowerShell #PoshMailKit, based on #MailKit, version 1.1.1 published to the #PowerShellGallery:… https://t.co/hj3WHKq5A9
    Jun 29, 2022, 1:54 PM
  • Using Visual Studio Code Syntax highlighting to make PowerShell better https://t.co/XoFrFonUQ9 #PowerShell #VSCode #SyntaxHighlighting
    Apr 26, 2022, 4:45 PM
  • "PoshMailKit" Release version 1.1.0 published to Gallery https://t.co/MNbDLtu8VG #PowerShell #SendMailMessage #MailKit #PoshMailKit
    Apr 20, 2022, 12:59 PM
  • "PoshMailKit" version 0.9.1-beta2 published to Gallery https://t.co/BUBdaYn86a #PowerShell #SendMailMessage #MailKit #PoshMailKit
    Mar 14, 2022, 10:55 AM
  • New project announcement: "PSMailKit" https://t.co/o3kme1upaE #PowerShell #SmtpClient #Send-MailMessage #MailKit
    Mar 8, 2022, 6:54 PM

Powered by Squarespace