0

Alright so this is tricky, or at least I think it is.

I want to send a list of recipients a welcome aboard email. Right now what I do is manually copy a mail in my Drafts folder in Outlook, appending the recipients and sending. Obviously that doesn't scale.

Sending mail with PowerShell is easy, sending HTML mail is easy; BUT I don't know how to send a mail that is based on this "template" which has two embedded PNGs (logos and such).

I wish I could something like:

$Body=OutLook.msg

Your thoughts?

PS Right now I am experimenting with saving the Outlook message as HTML, this could be entirely the wrong path.

2 Answers 2

1

Save a template message as an OFT file, then programmatically call Application.CreateItemFromTemplate. Populate the recipients appropriately (MailItem.Recipients.Add), modify the message body if you need to (MailItem.HTMLBody), and send it (MailItem.Send).

Sign up to request clarification or add additional context in comments.

6 Comments

I'm reading: msdn.microsoft.com/en-us/magazine/dn189202.aspx and computerperformance.co.uk/powershell/… how and when do I call that namespace? Or are you suggesting that I use VBA? I'd like to automate this as much as possible and keep it out of Outlook altogether if need be.
I am not sure what you mean by "how and when do I call that namespace". Namespace object is returned from Application.GetNamespace("MAPI").
> Namespace object is returned from Application.GetNamespace("MAPI") In what language? PowerShell? Is there an assembly I have to load?
C:\..\scripts\ps>_ Application.GetNamespace("MAPI") Application.GetNamespace : The term 'Application.GetNamespace' is not recognized as the name of a cmdlet, function, script file, or operable program.
|
0
$ol = New-Object -comObject Outlook.Application

$mail = $ol.CreateItem(0)
$mail.Subject = "Top demand apps-SOURCE CLARIFICATION"
$mail.HTMLBody="<html><head></head><body><b>Joseph</b></body></Html>"
$mail.save()

$inspector = $mail.GetInspector
$inspector.Display()

Just replace the html content in the body session, it will open as a draft mail in outlook.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.