Starting Outlook and having an email pre-populated

2019-01-13 21:34发布

Is this possible? I want to have the To:, Body, and an Attachment all pre-populated so all the user has to do is click send. Thanks!

3条回答
神经病院院长
2楼-- · 2019-01-13 22:02

You can attach files AND pre-fill in the To/Body if you simply place " " quotes around the command after the /m

Example:

outlook.exe /c ipm.note /m "someone@microsoft.com&subject=test%20subject&body=test%20body" /a test.txt
查看更多
兄弟一词,经得起流年.
3楼-- · 2019-01-13 22:03

VonC's solution works, but as stated in the comments by skbergam it doesn't allow for attachments.

If, like me, that's a biggie then the following WSH code does it.

Set olApp = CreateObject("Outlook.Application")
Set olMsg = olApp.CreateItem(0)

With olMsg
  .To = "test@testing.com"
  '.CC = "cc@testing.com"
  '.BCC = "bcc@testing.com"
  .Subject = "Subject"
  .Body = "Body"
  .Attachments.Add "C:\path\to\attachment\test.txt" 

  .Display
End With

I've tried it with Outlook2003

查看更多
仙女界的扛把子
4楼-- · 2019-01-13 22:14

Open a new mail message (ipm.note is the message class for emails)

outlook.exe /c ipm.note

Open a new mail message and populate sender:

outlook.exe /c ipm.note /m someone@microsoft.com

Open a new mail message with attachment:

 outlook.exe /c ipm.note /a filename

Combination: (First one below didn't work in Office 2016, second did)

 outlook.exe /c ipm.note /m someone@microsoft.com&subject=test%20subject&body=test%20body
 outlook.exe /c ipm.note /m "someone@microsoft.com&subject=test%20subject&body=test%20body"

The %20 has to be used to produce a blank space.

查看更多
登录 后发表回答