写真を埋め込んで(添付せずに)メールを送信するpowershellスクリプトがあります。画像が 1500x5000 ピクセルに拡大され、画像の長さが圧縮されて画像が歪んでいることがわかりました。ただし、Outlook を介して手動で画像を挿入して電子メールを送信すると、問題なく表示されます。
写真を保存してからペイントなどで開くと、写真は正常に開きます。メールでは圧縮されているように見えます。そこで何が起こっているのか知っている人はいますか?
{
$Application = "C:\Autobatch\Spotfire.Dxp.Automation.ClientJobSender.exe"
$Arguments = "http://s.net:8070/spotfireautomation/JobExecutor.asmx C:\Autobatch\HourlyStats.xml"
$CommandLine = "{0} {1}" -f $Application,$Arguments
invoke-expression $CommandLine
$file = "C:\Autobatch\HourlyStats.png"
$smtpServer = "smtp.staom.sec.s.net"
$att = new-object Net.Mail.Attachment($file)
$att.ContentType.MediaType = “image/png”
$att.ContentId = “pict”
$att.TransferEncoding = [System.Net.Mime.TransferEncoding]::Base64
$msg = new-object Net.Mail.MailMessage
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.Attachments.Add($att)
$msg.From = "d.k@s.com"
$msg.To.Add("r.p@p.com")
$msg.Subject = "Voice and Data Hourly Stats"
$msg.Body = "<p style=’font-family: Calibri, sans-serif’>
Voice and data hourly stats details<br />
</p>
<img src='cid:pict'/>"
$msg.IsBodyHTML = $true
$smtp.Send($msg)
$att.Dispose()
invoke-expression "DEL $file"
}
メールの写真はこんな感じ。