With only few steps, you can easily and quickly use UltimateMail component in PowerShell as described below:
To load UltimateMail component for using in PowerShell, simply use the [Reflection.Assembly]::LoadFrom command as demonstrated below:
PS C:\> [Reflection.Assembly]::LoadFrom("C:\ComponentPro\UltimateMail vX.X.X.X\Bin\NetX_X\ComponentPro.Mail.dll")
PS C:\> [Reflection.Assembly]::LoadFrom("ComponentPro.Mail, Version=X.X.X.X, Culture=neutral, PublicKeyToken=0efede2d78b28dff")
Now you are ready to use all classes inside the UltimateMail component. For example, to Connect, Authenticate and Download a message from an IMAP server, you can use the following script:
PS C:\> $client = New-Object ComponentPro.Net.Mail.Imap PS C:\> $client.Connect("myserver") PS C:\> $client.Authenticate("user", "pass") PS C:\> $client.Select("INBOX") PS C:\> $client.DownloadMessage(1) PS C:\> $client.Disconnect() PS C:\> $client.Dispose()