Automatically modifying an email

S

scottb2

Since I can't seem to get attachments to work with "mailto" (see m
previous post "URL opening a new email"), I'm thinking about anothe
way. If I were to issue the following URL in IE:
mailto:[email protected][email protected],attachment=c:\t.txt&subject=this%20is%20a%20subject&body=this%20is%20a%20body

which places the filename to be attached in the "To" line. I'd the
programatically remove the filename from the "To" line and add th
attachment.

I'm not sure how to run my code just by creating the email with th
URL. Also, is it possible to remove an address from the "To" list? An
pointers are appreciated.

Thanks,
Scot
 
S

scottb2

True, but in the first email, I described a method of getting around th
problem. I'm using mailto to open an email and fill in everythin
except for the attachment. I then need to gain control by handling som
event and then using Item.Attachment to create the attachment.

So I have two problems. The first problem is how to let my code kno
what is supposed to be attached. By specifying a fake "To" address (a
described in the first email), the code can do the right thing. I the
only need to know how to get control. Would a NewInspector even
handled in the ThisOutlookSession module do the job?

Is the "fake To: address" method workable? Is NewInspector the even
that ThisOutlookSession should be using to get control?

I'm trying to go about it this way because there should be only tw
keys hit once the information is selected: the first causes the mailt
command to be constructed and issued and the second submits the email.
I can't have any more keys hit to manually attach a file, manuall
select the email, etc.

Scott
You cannto add attachments through the mailto protocol.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
K

Ken Slovak - [MVP - Outlook]

The mailto: protocol opens an Outlook item using Simple MAPI.

In Outlook 2002 or later you do get that Inspector added to the Inspectors
collection, but there is no NewInspector() event. There are no events
telling you an item was added. That's true even in Outlook 2010.

The only way I've found to do what you want to do is to use a timer to check
the Inspectors collection against a list of handled Inspectors. I use
Inspector wrappers and wrapper collections anyway, so the infrastructure is
there already for me in any of my addins. If I find an unhandled Inspector I
know it's a Simple MAPI Inspector (which are opened modally, BTW).

Of course there are a number of flags I have to maintain and various
interlocks to make sure I don't handle a normal Outlook Inspector in both
NewInspector() and my timer event handler and end up handling an Inspector
twice. And I double-check on matching Inspectors with more than captions,
for example getting the Inspector window handle and then checking the window
RECT and screen position for a match, among other things. There are a number
of fault use cases where simple matching fails.

A fake To address could work but the item has to be saved to fill that in.
 

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