Command-line switch to attach MULTIPLE files

J

Jack B. Pollack

I'm using this command-line switch to attach a file to an email:
"C:\Program Files\Microsoft Office\Office11\OUTLOOK.EXE" /c ipm.note /a

It works perfectly if I specify just one file. Can it be modified to attach
multiple files to a new message?

Thanks
 
R

Roady [MVP]

No, but you can compress the multiple items first to a single zip-file and
attach that instead.
Depending on what you are trying to achieve, you can use the Outlook Object
Model to attach multiple files as well.

An example of using the OOM to include multiple attachments can be found
here;
http://www.howto-outlook.com/howto/mailpdfplus.htm
 
J

Jack B. Pollack

Thanks for your post.

I actually replaced the "send to" item with this command string to get rid
of the extraneous text etc. that the default one includes. The problem is
that I cant highlight multiple items and attach them.

I am interested in looking at the OOM sample but my AV software is flagging
that page as infected with VBS:SelfMailer-gen2 [Wrm].

Can anyone confirm that the page is safe to view.
 
R

Roady [MVP]

I can assure you that the page is safe to view.
What is reporting it as infected?
Are you using Avast?



Jack B. Pollack said:
Thanks for your post.

I actually replaced the "send to" item with this command string to get rid
of the extraneous text etc. that the default one includes. The problem is
that I cant highlight multiple items and attach them.

I am interested in looking at the OOM sample but my AV software is
flagging that page as infected with VBS:SelfMailer-gen2 [Wrm].

Can anyone confirm that the page is safe to view.

Roady said:
No, but you can compress the multiple items first to a single zip-file
and attach that instead.
Depending on what you are trying to achieve, you can use the Outlook
Object Model to attach multiple files as well.

An example of using the OOM to include multiple attachments can be found
here;
http://www.howto-outlook.com/howto/mailpdfplus.htm
 
J

Jack B. Pollack

yep, Avast

Roady said:
I can assure you that the page is safe to view.
What is reporting it as infected?
Are you using Avast?



Jack B. Pollack said:
Thanks for your post.

I actually replaced the "send to" item with this command string to get
rid of the extraneous text etc. that the default one includes. The
problem is that I cant highlight multiple items and attach them.

I am interested in looking at the OOM sample but my AV software is
flagging that page as infected with VBS:SelfMailer-gen2 [Wrm].

Can anyone confirm that the page is safe to view.

Roady said:
No, but you can compress the multiple items first to a single zip-file
and attach that instead.
Depending on what you are trying to achieve, you can use the Outlook
Object Model to attach multiple files as well.

An example of using the OOM to include multiple attachments can be found
here;
http://www.howto-outlook.com/howto/mailpdfplus.htm



-----

I'm using this command-line switch to attach a file to an email:
"C:\Program Files\Microsoft Office\Office11\OUTLOOK.EXE" /c ipm.note /a

It works perfectly if I specify just one file. Can it be modified to
attach multiple files to a new message?

Thanks
 
J

Jack B. Pollack

This looks like it might work. Does anyone have a pre-written VBS or WSH
script to take a string and create a blank message with the passed
attachments (ie "send to" vbs script would create a blank message with the
specified attachments).
 
J

Jack B. Pollack

If anyone is interested I wrote this VB script to replace the built in "Send
To Mail Recipient" item. It doesn't insert all the BS text the default one
does.

Save the script as "Mail Recipient.vbs" in you MS office folder.
Delete the "Mail recipient" item in your "%homepath%/sendto" folder
Create a shortcut to the new Mail Recipient script in the sendto folder
Change the icon to the new shortcut to "%SystemRoot%\system32\sendmail.dll"


On Error Resume Next
Set App = GetObject(, "Outlook.Application")
If Err <> 0 Then Set App = CreateObject("Outlook.Application")
Set AppItem = App.CreateItem(0)


If WScript.Arguments.Count > 0 then

For FileName = 0 to (WScript.Arguments.Count - 1)
AppItem.Attachments.Add WScript.Arguments(FileName)
Next


AppItem.Display

End If


Set App = Nothing
Set AppItem = Nothing






Hope this helps someone
 
Joined
Mar 29, 2021
Messages
1
Reaction score
0
If anyone is interested I wrote this VB script to replace the built in "Send
To Mail Recipient" item. It doesn't insert all the BS text the default one
does.

...

Hope this helps someone
Quite old, but this works perfect for me with my Office 2016. Thank you!

One question: Is here a way to add some more code to resize the selected attachment-files (should all be e.g. JPG-pictures)?
E.g. using XNView or something equal?

Or call a .BAT/.CMD from your .VBS-Script which send the selected filenames/path to the .BAT/.CMD-Batchfile?
Because I´m cannot write in .VBS but only in .BAT-Language...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top