I have a code that kinda does what ssrs-subscription can do. Except, users are asking to view the actual attached-report in the body of their emails. So say I'm attaching a .pdf or .mht file to the email. Users want to be able to see these files right in their email.
I've tried the "AlternativeView" option, and setting contentType to "application/pdf" or "multipart/related". Nothing's working. I get a buncha binary data displayed in the body of my email
Your help is much appreciated!
Here's a sample of the code (due to some internal policies it had to be written in powershell... but powershell, C#, tomayto, tomahto... just different syntax i guess:
I've tried the "AlternativeView" option, and setting contentType to "application/pdf" or "multipart/related". Nothing's working. I get a buncha binary data displayed in the body of my email
Your help is much appreciated!
Here's a sample of the code (due to some internal policies it had to be written in powershell... but powershell, C#, tomayto, tomahto... just different syntax i guess:
Code:
$smtp = new-object Net.Mail.SmtpClient("MailSerer")
$msg = new-object Net.Mail.MailMessage
$msg.From = "fromAddress"
$msg.To.Add($toAddress)
$msg.subject = "test"
$msg.IsBodyHtml = $true
$att = new-object Net.Mail.Attachment($fileName)
$msg.Attachments.Add($att)
$vu = New-Object System.Net.Mail.AlternateView($fileName)
$vu.ContentType = New-Object System.Net.Mime.ContentType("multipart/related");
$lr = New-Object System.Net.Mail.LinkedResource($fileName, "application/pdf")
$vu.LinkedResources.Add($lr)
$msg.AlternateViews.Add($vu);
$smtp.Send($msg)