The following Outlook's command works well with Outlook 2010:
outlook.exe /c ipm.note /m "&subject=abc" /a "c:\attach.txt"
But it does not work with Outlook 2007 and 2003. The strange are following commands work well with Outlook 2007 and 2003:
outlook.exe /c ipm.note /m "&subject=abc"
outlook.exe /c ipm.note /a "c:\attach.txt"
How do I use one command line switch to launch Outlook to compose message with both subject and attachment for Outlook 2010/2007/2003?
So far from what I've discovered with Outlook 2007 is that in order to achieve this you have to realize that /a implies /c IPM.note.
So using
outlook.exe /a "FileName" /m "addresses&cc=&subject=&body="
Works just fine (took me forever to figure this out cause everyone on the web appears to insist that you must use /c when doing /m but not taking into account that /a does this for you automatically.
Also, I've noticed that using %20 isn't exactly correct when needing to put spaces, instead %2 (%20 without the 0) is doing the trick there. Otherwise you'll end up with a bunch of 0's after all the spaces, very strange indeed.
I'm going to add this here.
Every time I get a new PC, I have to configure my Task Scheduler to launch my daily email to management. Every time I search, I come across this one, but it isn't quite what I want.
I want a daily email to be sent to a group entitled "DailyLog" with the Subject="Daily Log" (I didn't say I was being original).
I start with this KB from Microsoft:
How to use command line switches to create a pre-addressed e-mail message in Outlook
Here are the screenshots for that, but the only one you really need to pay attention to is the Action tab:
In the image above, the Actions tab is where all of the important information goes.
Depending on your version of Microsoft Outlook, your path could look different.
Notice the Program/script section needs to be in quotes. The Add arguments (optional) is NOT in quotes!
Here is what I use in the arguments text box:
/c ipm.note /m DailyLogGroup;&subject=Daily%20Log
The /c switch creates the message (ipm.note), and the /m switch places the group DailyLogGroup in the TO field with the text Daily Log in the subject (%20 is a blank space).
Outlook > Tools > Forms > DesignForm > Message > Open
To = "abc@xyz.com"
ViewCode
Function Item_Open()
If Item.Size = 0 Then : Item.Send : End If
End Function
File > Close > Publish > PublishFormAs
DisplayName = "test_130713_0856"
Publish > [CLOSE] > Yes
send_email.bat
--------------
"C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE" ^
/c "IPM.Note.test_130713_0856" ^
/m "abc@xyz.com&subject=hello world&body=blah blah blah" ^
/a h:\test.txt
来源:https://stackoverflow.com/questions/7912973/launch-outlook-to-compose-a-message-with-subject-and-attachment-by-outlooks-com