Created
May 14, 2018 02:16
-
-
Save ppineda32/19767e72ec062b3ebd8f2e1fb67ec474 to your computer and use it in GitHub Desktop.
Create from template. replace date field, replace image and make it inline attachement.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$attachment = Get-Item C:\Users\Akabane\Desktop\2018-05-05_19-20-53.png | |
$ol = New-Object -comObject Outlook.Application | |
$mail = $ol.CreateItemFromTemplate('C:\Users\Akabane\Desktop\ajajajajaj.oft') | |
$mail.HTMLBody = $mail.HTMLBody.Replace('#FECHA#', '10/25/15') | |
$mail.HTMLBody = $mail.HTMLBody.Replace('#IMAGEN#', '<br /><img src="{0}" />' -f ($attachment.Name)) | |
$attach = $mail.Attachments.Add($attachment.FullName) | |
$attach.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F", "2018-05-05_19-20-53.png") | |
$inspector = $mail.GetInspector | |
$mail.SaveAs('C:\Users\Akabane\Desktop\template.oft') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment