Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Automatically modifying an email (http://www.outlookbanter.com/outlook-vba/101046-automatically-modifying-email.html)

scottb2 March 17th 10 04:49 AM

Automatically modifying an email
 

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

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

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

Thanks,
Scott


--
scottb2
http://forums.slipstick.com


Dmitry Streblechenko March 17th 10 10:17 PM

Automatically modifying an email
 
You cannto add attachments through the mailto protocol.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"scottb2" scottb2.47ybta@invalid wrote in message
news:scottb2.47ybta@invalid...

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

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

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

Thanks,
Scott


--
scottb2
http://forums.slipstick.com




scottb2 March 19th 10 07:32 PM

Automatically modifying an email
 

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

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

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

I'm trying to go about it this way because there should be only two
keys hit once the information is selected: the first causes the mailto
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, manually
select the email, etc.

Scott

Dmitry Streblechenko;133342 Wrote:
You cannto add attachments through the mailto protocol.


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"scottb2" scottb2.47ybta@invalid wrote in message
news:scottb2.47ybta@invalid...[color=blue]

Since I can't seem to get attachments to work with "mailto" (see my
previous post "URL opening a new email"), I'm thinking about another
way. If I were to issue the following URL in IE:

,attachment=c:\t .txt&subject=this%20is%20a%20subject&body=this%20i s%20a%20body

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

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

Any
pointers are appreciated.



--
scottb2
http://forums.slipstick.com


Ken Slovak - [MVP - Outlook] March 19th 10 08:37 PM

Automatically modifying an email
 
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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"scottb2" scottb2.48364a@invalid wrote in message
news:scottb2.48364a@invalid...

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

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

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

I'm trying to go about it this way because there should be only two
keys hit once the information is selected: the first causes the mailto
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, manually
select the email, etc.

Scott




All times are GMT +1. The time now is 11:35 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com