|
- param(
- [Parameter(Mandatory = $true)][string]$RequestPath,
- [string]$ConfigPath = (Join-Path (Split-Path -Parent $PSScriptRoot) 'config.ini'),
- [string]$OutputRoot
- )
- $ErrorActionPreference = 'Stop'
- . (Join-Path $PSScriptRoot 'campaign-common.ps1')
- if (-not $OutputRoot) { $OutputRoot = Join-Path (Split-Path -Parent $ConfigPath) 'temp\previews' }
- $context = Get-MailContext -ConfigPath $ConfigPath
- $request = Read-CampaignRequest $RequestPath
- $db = Open-MailDatabase $context
- try {
- $review = Get-CampaignReview $context $request $db
- $previewPath = Write-CampaignPreview $review $OutputRoot
- [pscustomobject]@{
- Count = $review.Contacts.Count
- Token = $review.Token
- PreviewPath = $previewPath
- TemplateName = $review.TemplateName
- TemplateVersion = $review.TemplateVersion
- From = $review.Identity.From
- ReplyTo = $review.Identity.ReplyTo
- TestTo = $review.Identity.TestTo
- PostalAddress = $review.Identity.Postal
- Subject = $review.Subject
- } | ConvertTo-Json -Compress
- }
- finally { $db.Dispose() }
|