Send attachement automatically with right click - send to

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I try to automatize some of my tasks. Goal is to right click on file, choose
Outlook from 'Send To' menu and that is all. Outlook should send attachement
to recipient (always the same).

I created short cut to Outlook and moved it to 'Send To' folder in my
profile folder.

When I right click on file and choose Outlook short cut it opens Outlook
with file attached. Now I need some code which will fill 'To' field of
message and will send it.

Code must be invoked by /autorun switch in short cut properties, I guess?

How to write it?

Thanks a lot.
 
Hi,

OL knows start parameters: /m is for the recipient, /a for an
attachment. But unfortunately you can´t use both at once.

If OL is running already then you could monitor the NewInspector event.
In this check for the attachment. If it´s always the same attachment
then you could add the recipient now. If the attachments are different
then check for Attachment.Count and display a simple MsgBox, asking you
for adding the recipient or not.
 
I try to automatize some of my tasks. Goal is to right click on file, choose
Outlook from 'Send To' menu and that is all. Outlook should send attachement
to recipient (always the same).

I created short cut to Outlook and moved it to 'Send To' folder in my
profile folder.

When I right click on file and choose Outlook short cut it opens Outlook
with file attached. Now I need some code which will fill 'To' field of
message and will send it.

Code must be invoked by /autorun switch in short cut properties, I guess?

How to write it?

Under Outlook 9 and 10, the following command line would work:

OUTLOOK /c ipm.note /m (e-mail address removed) /a FQN

where FQN is the fully qualified filename to be attached, quoted if
necessary. Apparently, this does not work under Outlook 11 any more: the
switches /m and /a seem to be mutually exclusive now.

There are also reports that /autorun doesn't work at all. AFAIK /autorun
only seems to work when no instance of Outlook is already running.

The code you ask for would look something like this (untested):

Sub SendFixedAddress()
Dim myMailItem As MailItem
Set myMailItem = ActiveInspector.CurrentItem
myMailItem.Recipients.Add ("(e-mail address removed)")
myMailItem.Send
End Sub

invoked with:
OUTLOOK /autorun SendFixedAddress /a FQN

You did not mention whether you want to automate the Subject line. This
should do that:
myMailItem.Subject = "Your Subject Line"

A purely command line based tool which lends itself more to automation
might be preferrable; blat or one of many SendMail tools, some of them
in VBS using Outlook or CDO, seem more appropriate for your task. In
fact, the command line interface I use (4NT) has a SENDMAIL command
built-in.
 
Back
Top