KB migration with Inline images


I am trying to perform a KB article migration for a customer from SNOW to FS. We have inline attachments that need to be migrated in the body of the article. I know these articles are uploaded to FS via JWT. Is there a certain call that I can use to upload the inline pic then pass the response back as the source in the HTML tag? if so, what is the end point?

So I was not able to figure out the JWT route, but I was able to solution for sending KB articles to the email for the KB with inline attachments with PowerShell.

Here is my solution:

# Set email parameters
$smtpServer = "smtp.gmail.com"
$from = " "
$To = " "
$subject = "Test Email with Inline Attachment"
$attachmentPath = "./test.jpg"
$contentType = "image/jpeg"

# Convert attachment to base64
$fileContent = [System.IO.File]::ReadAllBytes($attachmentPath)
$base64Content = [System.Convert]::ToBase64String($fileContent)
$attachmentDataUri = "data:$contentType;base64,$base64Content"

[securestring]$Password = "" | ConvertTo-SecureString -AsPlainText -Force

# Create email object
$mailMessage = New-Object System.Net.Mail.MailMessage
$mailMessage.From = $from
$mailMessage.Subject = $subject
$mailMessage.IsBodyHtml = $true

$htmlBody = @"
<p>This is a test email with an inline attachment.</p>
<img src="cid:attachmentImage" alt="Inline Attachment">

$mailMessage.Body = $htmlBody

# Create linked resource for the attachment
$attachment = New-Object System.Net.Mail.LinkedResource -ArgumentList $attachmentPath
$attachment.ContentId = "attachmentImage"

# Add linked resource to the email's alternate view
$htmlView = [System.Net.Mail.AlternateView]::CreateAlternateViewFromString($htmlBody, $null, "text/html")

# Send email
$smtp = New-Object System.Net.Mail.SmtpClient($smtpServer, 587)
$smtp.Credentials = New-Object System.Net.NetworkCredential($From, $Password)
$smtp.EnableSsl = $true 

Write-Host "Email sent successfully."

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.