472,986 Members | 2,874 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Error with Simplemapi.py

On Dec 24 2004, 4:56 pm, i...@kirbyfooty.com wrote:
I wish I new why google doesn't show nicely aligned python code when
you paste the script.
Anyways, in case this helps someone else you can download the script
fromhttp://www.kirbyfooty.com/simplemapi.py

Ian
First of all, thanks to all involved, this looks like what I need
without re-inventing the wheel.
Sorry to Ian if he just recieved 2 emails, my bad, I need to learn how
to use this board better!

I have a small problem. I get an error I don't know how to resolve,
any help would be much appreciated.
I'm using Python25 on winXP pro and the script from the link above.
Here's the error -
>>mailtest.SendMail('n****@somewhere.net','test',' test string','c:\dbs.txt')
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
mailtest.SendMail('n****@somewhere.net','test','te st string','c:
\dbs.txt')
File "C:\Python25\mailtest.py", line 135, in SendMail
cast(NULL, lpMapiRecipDesc), RecipCnt, recip,
File "C:\Python25\lib\ctypes\__init__.py", line 478, in cast
return _cast(obj, obj, typ)
ArgumentError: argument 1: <type 'exceptions.TypeError'>: wrong type
>>>
I have had a brief look at the C api for these structs and functions
but I can't resolve it, it is probably something simple.
The piece of code I don't understand though is this -

MapiRecipDesc_A = MapiRecipDesc * len(RecipWork) #size of struct??
rda = MapiRecipDesc_A() # isn't it MapiRecipDesc as declared??

There's some new stuff going on here I don't understand.

thanks for your help,
Mick.

Aug 24 '07 #1
1 1190
En Fri, 24 Aug 2007 04:03:05 -0300, Mick Duprez <du****@hinet.net.au>
escribi�:
I have a small problem. I get an error I don't know how to resolve,
any help would be much appreciated.
I'm using Python25 on winXP pro and the script from the link above.
Here's the error -
>>>mailtest.SendMail('n****@somewhere.net','test', 'test
string','c:\dbs.txt')
That should be 'c:\\dbs.txt' or r'c:\dbs.txt'
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
mailtest.SendMail('n****@somewhere.net','test','te st string','c:
\dbs.txt')
File "C:\Python25\mailtest.py", line 135, in SendMail
cast(NULL, lpMapiRecipDesc), RecipCnt, recip,
File "C:\Python25\lib\ctypes\__init__.py", line 478, in cast
return _cast(obj, obj, typ)
ArgumentError: argument 1: <type 'exceptions.TypeError'>: wrong type
>>>>
I'm unsure what those cast(NULL, ...) are supposed to do, but they look
all wrong. NULL, as defined on that script, is *not* a C NULL pointer (use
None for that).
(In fact the whole script doesn't look well at all - do you *have* to use
MAPI? can't use SMTP instead? Even if you must use MAPI, try the pywin32
package from Mark Hammond, it has MAPI support and a demo script for
sending mail)
I have had a brief look at the C api for these structs and functions
but I can't resolve it, it is probably something simple.
The piece of code I don't understand though is this -

MapiRecipDesc_A = MapiRecipDesc * len(RecipWork) #size of struct??
This declares a new type, an array of len(RecipWork) items, each of type
MapiRecipDesc
rda = MapiRecipDesc_A() # isn't it MapiRecipDesc as declared??
This creates an instance of the above array.

--
Gabriel Genellina

Aug 27 '07 #2

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

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.