473,379 Members | 1,283 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Fun with Outlook and MAPI

I'm trying to send an e-mail through outlook. So far I've gotten it to
work with the mail script at
http://aspn.activestate.com/ASPN/Coo.../Recipe/149461 My only
problem is that when I call Resolve() and Send(), I get confirmation
dialogs. I will be sending out quite a few e-mails at a time, and would
rather not have the user have to click yes for every single one. Does
anyone know a workaround? I know about smtplib, but I would prefer to
simply make what I have work. Thanks.

Chris
Jul 18 '05 #1
14 4775
Chris wrote:
I'm trying to send an e-mail through outlook. So far I've gotten it to
work with the mail script at
http://aspn.activestate.com/ASPN/Coo.../Recipe/149461 My only
problem is that when I call Resolve() and Send(), I get confirmation
dialogs. I will be sending out quite a few e-mails at a time, and would
rather not have the user have to click yes for every single one. Does
anyone know a workaround? I know about smtplib, but I would prefer to
simply make what I have work. Thanks.


Alas, I dont think that there is much you can do to prevent the
confirmation dialogs with Outlook's MAPI dll. MS added them in a service
pack as an anti-virus measure, so no work-around. Not all clients show
these anoying dialogs though. Thunderbird definately doesn't.
Regards,

Will McGugan
Jul 18 '05 #2
Will McGugan wrote:
Chris wrote:
I'm trying to send an e-mail through outlook. So far I've gotten it
to work with the mail script at
http://aspn.activestate.com/ASPN/Coo.../Recipe/149461 My
only problem is that when I call Resolve() and Send(), I get
confirmation dialogs. I will be sending out quite a few e-mails at a
time, and would rather not have the user have to click yes for every
single one. Does anyone know a workaround? I know about smtplib, but
I would prefer to simply make what I have work. Thanks.

Alas, I dont think that there is much you can do to prevent the
confirmation dialogs with Outlook's MAPI dll. MS added them in a service
pack as an anti-virus measure, so no work-around. Not all clients show
these anoying dialogs though. Thunderbird definately doesn't.


There is actually a workaround. You're using Simple MAPI which has a
nice easy interface. The confirmation dialogs are only for Simple MAPI.
Using Extended MAPI can work around the problem but its a lot more tricky.
See the initial discussion here:
http://aspn.activestate.com/ASPN/Mai...-win32/2160646

This code has now been included in pywin32 somehow but I can't remember
where and its late. Should also be a cookbook entry. Maybe Google can
help :-)

David
Jul 18 '05 #3
David Fraser wrote:

Alas, I dont think that there is much you can do to prevent the
confirmation dialogs with Outlook's MAPI dll. MS added them in a
service pack as an anti-virus measure, so no work-around. Not all
clients show these anoying dialogs though. Thunderbird definately
doesn't.


There is actually a workaround. You're using Simple MAPI which has a


I stand corrected.

Will McGugan

Jul 18 '05 #4
Will McGugan wrote:
I'm trying to send an e-mail through outlook. So far I've gotten it
to work with the mail script at
http://aspn.activestate.com/ASPN/Coo.../Recipe/149461 My
only problem is that when I call Resolve() and Send(), I get
confirmation dialogs. I will be sending out quite a few e-mails at a
time, and would rather not have the user have to click yes for every
single one. Does anyone know a workaround? I know about smtplib, but
I would prefer to simply make what I have work. Thanks.

Alas, I dont think that there is much you can do to prevent the
confirmation dialogs with Outlook's MAPI dll. MS added them in a service
pack as an anti-virus measure, so no work-around. Not all clients show
these anoying dialogs though. Thunderbird definately doesn't.


Unfortunately, I don't have the option of installing Thunderbird.

Chris
Jul 18 '05 #5
>> Alas, I dont think that there is much you can do to prevent the
confirmation dialogs with Outlook's MAPI dll. MS added them in a
service pack as an anti-virus measure, so no work-around. Not all
clients show these anoying dialogs though. Thunderbird definately
doesn't.

There is actually a workaround. You're using Simple MAPI which has a
nice easy interface. The confirmation dialogs are only for Simple MAPI.
Using Extended MAPI can work around the problem but its a lot more tricky.
See the initial discussion here:
http://aspn.activestate.com/ASPN/Mai...-win32/2160646

This code has now been included in pywin32 somehow but I can't remember
where and its late. Should also be a cookbook entry. Maybe Google can
help :-)


Cool. I'll take a look an' see if I can get it to work. MAPI has
turned out to be a major PITA. Especially when trying to learn it and
Python at the same time. :)

Chris
Jul 18 '05 #6
At the risk of beating a dead horse, but you really should consider
using SMTP instead if you are really going to be sending a lot
of messages. I think you will find it more reliable and much faster.
It also eliminates the need for ANY email client to be on the machine
that is sending the messages.

http://motion.technolust.cx/related/send_jpg.py

Here is a link to a class that wraps everything up very nicely. You
should be able to be sending SMTP emails with it in 10-15 minutes.
It supports binary attachments as well.

FYI,
Larry Bates

Chris wrote:
I'm trying to send an e-mail through outlook. So far I've gotten it to
work with the mail script at
http://aspn.activestate.com/ASPN/Coo.../Recipe/149461 My only
problem is that when I call Resolve() and Send(), I get confirmation
dialogs. I will be sending out quite a few e-mails at a time, and would
rather not have the user have to click yes for every single one. Does
anyone know a workaround? I know about smtplib, but I would prefer to
simply make what I have work. Thanks.

Chris

Jul 18 '05 #7

"Larry Bates" <lb****@syscononline.com> wrote in message news:lv********************@comcast.com...
At the risk of beating a dead horse, but you really should consider
using SMTP instead if you are really going to be sending a lot
of messages.


The problem is that doesn't work in more complicated configurations
such as when authentication and/or SSL have to happen, not to mention
the issue of configuring servers and ports, that users have already
configured in their mail clients. Additionally when you use MAPI,
messages that you send also end up in your sent items folder. (I
also have not had any issue sending lots of messages using MAPI).

Ultimately the utility of vanilla of pure SMTP will depend on
customer requirements and how simple the configuration is.

Roger
Jul 18 '05 #8

"Chris" <ch*****@us-hampton.mail.saic.com> wrote in message news:ma**************************************@pyth on.org...
My only problem is that when I call Resolve() and Send(), I get confirmation dialogs. I will be sending out quite a few e-mails
at a time, and would rather not have the user have to click yes for every single one.


Here is an simple workaround:

http://www.contextmagic.com/express-clickyes/

If you have win32all installed, you can even use the programming API
they present to turn on and off the clickyes functionality.

Roger
Jul 18 '05 #9
Chris wrote:
Alas, I dont think that there is much you can do to prevent the
confirmation dialogs with Outlook's MAPI dll. MS added them in a
service pack as an anti-virus measure, so no work-around. Not all
clients show these anoying dialogs though. Thunderbird definately
doesn't.


There is actually a workaround. You're using Simple MAPI which has a
nice easy interface. The confirmation dialogs are only for Simple
MAPI. Using Extended MAPI can work around the problem but its a lot
more tricky.
See the initial discussion here:
http://aspn.activestate.com/ASPN/Mai...-win32/2160646

This code has now been included in pywin32 somehow but I can't
remember where and its late. Should also be a cookbook entry. Maybe
Google can help :-)

Cool. I'll take a look an' see if I can get it to work. MAPI has
turned out to be a major PITA. Especially when trying to learn it and
Python at the same time. :)

Chris


There's recently been some discussion of this topic on the python-win32
list, most lately to accommodate moving sent messages to the Sent
folder. I've personally sent several hundred messages using the
techniques outlined there.

http://mail.python.org/pipermail/pyt...st/002239.html is
a good starting point.

regards
Steve
--
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
Jul 18 '05 #10
>>At the risk of beating a dead horse, but you really should consider
using SMTP instead if you are really going to be sending a lot
of messages.

The problem is that doesn't work in more complicated configurations
such as when authentication and/or SSL have to happen, not to mention
the issue of configuring servers and ports, that users have already
configured in their mail clients. Additionally when you use MAPI,
messages that you send also end up in your sent items folder. (I
also have not had any issue sending lots of messages using MAPI).

Ultimately the utility of vanilla of pure SMTP will depend on
customer requirements and how simple the configuration is.


That pretty much sums it up. Also, since everything is done over IMAP
with Outlook, I don't really have access to an SMTP server.

Chris
Jul 18 '05 #11
> There is actually a workaround. You're using Simple MAPI which has a
nice easy interface. The confirmation dialogs are only for Simple MAPI.
Using Extended MAPI can work around the problem but its a lot more tricky.
See the initial discussion here:
http://aspn.activestate.com/ASPN/Mai...-win32/2160646

This code has now been included in pywin32 somehow but I can't remember
where and its late. Should also be a cookbook entry. Maybe Google can
help :-)


Okay, here's the results. The good news is that the code sent the mail
without any popup's. The bad news is that the sent e-mail stays in the
outbox instead of the sent folder. Any suggestions?

Chris
Jul 18 '05 #12
Chris wrote:
There is actually a workaround. You're using Simple MAPI which has a
nice easy interface. The confirmation dialogs are only for Simple
MAPI. Using Extended MAPI can work around the problem but its a lot
more tricky.
See the initial discussion here:
http://aspn.activestate.com/ASPN/Mai...-win32/2160646

This code has now been included in pywin32 somehow but I can't
remember where and its late. Should also be a cookbook entry. Maybe
Google can help :-)

Okay, here's the results. The good news is that the code sent the mail
without any popup's. The bad news is that the sent e-mail stays in the
outbox instead of the sent folder. Any suggestions?

Chris


Well, only the same one I've already made, which is to look on the
win32all mailing list archives. Since this appears to be beyond you,
here's a note by Chad Stryker commenting on an original work by David
Fraser.

It may give you the clues you need, otherwise Google for the whole
thread(s).

"""Thank you for figuring this extended MAPI interface all out. I
discovered a couple of problems with the code (on my system at least).
First, the message in my outbox was marked as read. Second, the message
would remain in the outbox after it was sent. After several hours of
work, I added three lines to the function that mark the message as
unread and cause the message to be deleted from the outbox after it is sent.

First, I added a constant that I found in the MAPI header file MAPIDefS.h.

CLEAR_READ_FLAG = 4

Next I added two lines just before “outboxfolder.SaveChanges(0)”.

message.SetReadFlag(CLEAR_READ_FLAG)
message.SetProps([(mapitags.PR_DELETE_AFTER_SUBMIT,1)])

With these changes, the behavior in the outbox is consistent with
sending messages directly from Outlook.
"""

regards
Steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
Jul 18 '05 #13
>> Okay, here's the results. The good news is that the code sent the
mail without any popup's. The bad news is that the sent e-mail stays
in the outbox instead of the sent folder. Any suggestions?

Well, only the same one I've already made, which is to look on the
win32all mailing list archives. Since this appears to be beyond you,
here's a note by Chad Stryker commenting on an original work by David
Fraser.

It may give you the clues you need, otherwise Google for the whole
thread(s).

"""Thank you for figuring this extended MAPI interface all out. I
discovered a couple of problems with the code (on my system at least).
First, the message in my outbox was marked as read. Second, the message
would remain in the outbox after it was sent. After several hours of
work, I added three lines to the function that mark the message as
unread and cause the message to be deleted from the outbox after it is
sent.

First, I added a constant that I found in the MAPI header file MAPIDefS.h.

CLEAR_READ_FLAG = 4

Next I added two lines just before “outboxfolder.SaveChanges(0)”.

message.SetReadFlag(CLEAR_READ_FLAG)
message.SetProps([(mapitags.PR_DELETE_AFTER_SUBMIT,1)])

With these changes, the behavior in the outbox is consistent with
sending messages directly from Outlook.
"""

regards
Steve


Actually, I had already found that message. It still doesn't do what
I'm looking for(namely moving sent messages to the Sent folder).

Chris
Jul 18 '05 #14
Chris wrote:
Okay, here's the results. The good news is that the code sent the
mail without any popup's. The bad news is that the sent e-mail stays
in the outbox instead of the sent folder. Any suggestions?


Well, only the same one I've already made, which is to look on the
win32all mailing list archives. Since this appears to be beyond you,
here's a note by Chad Stryker commenting on an original work by David
Fraser.

It may give you the clues you need, otherwise Google for the whole
thread(s).

"""Thank you for figuring this extended MAPI interface all out. I
discovered a couple of problems with the code (on my system at least).
First, the message in my outbox was marked as read. Second, the
message would remain in the outbox after it was sent. After several
hours of work, I added three lines to the function that mark the
message as unread and cause the message to be deleted from the outbox
after it is sent.

First, I added a constant that I found in the MAPI header file
MAPIDefS.h.

CLEAR_READ_FLAG = 4

Next I added two lines just before “outboxfolder.SaveChanges(0)”.

message.SetReadFlag(CLEAR_READ_FLAG)
message.SetProps([(mapitags.PR_DELETE_AFTER_SUBMIT,1)])

With these changes, the behavior in the outbox is consistent with
sending messages directly from Outlook.
"""

regards
Steve

Actually, I had already found that message. It still doesn't do what
I'm looking for(namely moving sent messages to the Sent folder).

Chris

Well, in that case please excuse my crotchetiness. It's probably the
time of year.

bah-humbug-ly y'rs - steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119

Jul 18 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: V.C.Sekhar | last post by:
Hi there, Can any one please help in getting me Python-Outlook programming issue clarified. I just wanted to do the following using Python: 1)Open a New Oulook Mail Window
2
by: Fritz Switzer | last post by:
Can anyone provide a small snippet in C# that pulls out the Contacts in Outlook XP. I've seen a couple of examples in C++ and VB in previous newsgroup posts, but either the originals didn't work...
1
by: Neil Ginsberg | last post by:
A client of mine is using Outlook (2002, I believe), and is getting prompted for confirmation that another program is sending e-mail in his name. That confirmation has to go, as it's part of an...
0
by: John H. | last post by:
In effort to understand (Outlook) MAPI folder tree structure wrote simple linear code below to navigate tree. Successive "...Folders.GetNext()"'s return same folder at all levels of tree. What...
1
by: Peter | last post by:
I found this code and it works great. Is there any way to up date the code to export attachments to (c:\Exports)? =================================================== Dim olFolderCalendar As...
4
by: Brian Hampson | last post by:
I recently upgraded to Outlook 2007 B2TR and have found that I can no longer code against MAPI.DLL It's gone :( Using C#, I used to get the MAPI session, and from that I could change the out of...
0
by: awrightus | last post by:
I want to develop an interface to create, edit, and delete Outlook profiles. The system I want to do this on will Have Outlook 2003 on it. I can use much of the Office Interop stuff to...
4
by: venutaurus539 | last post by:
Hello, I was getting an error in Cocreate instance while trying to access "Outlook" using python script. The python script looks like: from win32com.client import Dispatch session =...
4
by: venutaurus539 | last post by:
Hi all, Can some one help me in obtaining the set of recipients email addresses from an outlook mail? I tried various options like message.Recipient.Address message.To.Address...
8
by: Rebecca McCallan | last post by:
I am essentially looking for a bit of code which will allow me to refer to an unspecified MAPI folder. Just to put that into context, My code creates a new folder if there is a new sender, the new...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.