Re: [python-win32] Using win32com.mapi to automate mail dispatch...

2010-04-27 Thread Varun Avashia
Understood, since I did not need very sophisticated code to do the bidding... 
(Just something little to keep exchange busy), I've started using following 
snippet which seems to be working great. Posting here for reference. Thank you 
all for your time...

from win32com.client import Dispatch
import random
s=Dispatch(Mapi.Session)
random.seed('')
MessageBody = ''
for i in range (1, 1): MessageBody += str(random.randint(0, 9))

for i in range(1,10): ##I'm gonna make this an infinite while loop 
eventually
  s.Logon(Outlook)
  newMsg = s.Outbox.Messages.Add(Test mail from Pythonwin32, MessageBody)
  recip1 = newMsg.Recipients.Add(mapi1, SMTP:ma...@mapi.aryaka.india)
  newMsg.Send()
  s.DeliverNow()
  s.Logoff()


P.S. I'm still interested in making the other snippet work. Is there any known 
issues with my configs?

 - Exchange 2k3 on win2k3 R2 server
 - CDO ver1.2.1
 - Pyton 2.6.4
 - pywin32 latest version
 - WinXPSP2 with Office2k7

-Original Message-
From: Mark Hammond [mailto:skippy.hamm...@gmail.com] 
Sent: Tuesday, April 27, 2010 11:05 AM
To: Varun Avashia
Cc: Python-Win32 List
Subject: Re: [python-win32] Using win32com.mapi to automate mail dispatch...

That EID was almost certainly fetched as a property, but the code isn't 
checking the returned property type before assuming it is a string 
entryid - in your case the type will be PT_ERROR, indicating the value 
holds the error reason as an integer.  As Tim mentioned, that code means 
the requested item wasn't found.

HTH,

Mark

On 27/04/2010 2:05 PM, Varun Avashia wrote:
 Yes Tim, the user has Admin privileges, and eid has a -ve value of 
 -2147221233.

 -Original Message-
 From: python-win32-bounces+varun.avashia=aryaka@python.org 
 [mailto:python-win32-bounces+varun.avashia=aryaka@python.org] On Behalf 
 Of Tim Roberts
 Sent: Tuesday, April 27, 2010 4:22 AM
 To: Python-Win32 List
 Subject: Re: [python-win32] Using win32com.mapi to automate mail dispatch...

 Varun Avashia wrote:



 I tried to follow the code on this link
 http://mail.python.org/pipermail/python-win32/2004-August/002239.html



 This worked fine for me on win7 with Outlook2k7 (CDO were installed
 separately), However this failed to work on winxp with sp2 and
 outlook2k7 (with CDO installed) with following trace-back….



 Traceback (most recent call last):

File C:\Documents and
 Settings\Administrator\Desktop\send1kMail.py, line 73,

   inmodule

  SendEMAPIMail(SendSubject, SendMessage, SendTo,
 MAPIProfile=MAPIProfile)

File C:\Documents and
 Settings\Administrator\Desktop\send1kMail.py, line 28,

   in SendEMAPIMail

  outboxfolder = msgstore.OpenEntry(eid,None,mapi.MAPI_BEST_ACCESS)

 TypeError: EntryID must be a string or None



 Am I missing any additional components for WinXP?



 The eid variable at line 27 has a value of -2147221233…


 For what it's worth, that's 0x8004010F, which is MAPI_E_NOT_FOUND.

 You might want to print out the eid that you fetched in the line
 immediately preceding.  Perhaps something went wrong with fetching the
 outbox ID.  Has Outlook 2007 actually been configured for Administrator
 on this machine?


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Using win32com.mapi to automate mail dispatch...

2010-04-27 Thread Tim Roberts
Varun Avashia wrote:
 Yes Tim, the user has Admin privileges,

And has this user already configured Outlook so that all of his
mailboxes really exist?

 and eid has a -ve value of -2147221233.
   

Duh, you did say that in the original message, didn't you...

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Using win32com.mapi to automate mail dispatch...

2010-04-26 Thread Varun Avashia
Also, the mails sent by this method show up in my personal folders outbox 
(which I imported from my old PC) and not the mailbox outbox...

From: Varun Avashia
Sent: Monday, April 26, 2010 6:30 PM
To: 'python-win32@python.org'
Subject: Using win32com.mapi to automate mail dispatch...

Hi,

I tried to follow the code on this link 
http://mail.python.org/pipermail/python-win32/2004-August/002239.html

This worked fine for me on win7 with Outlook2k7 (CDO were installed 
separately), However this failed to work on winxp with sp2 and outlook2k7 (with 
CDO installed) with following trace-back

Traceback (most recent call last):
  File C:\Documents and Settings\Administrator\Desktop\send1kMail.py, line 73,
 in module
SendEMAPIMail(SendSubject, SendMessage, SendTo, MAPIProfile=MAPIProfile)
  File C:\Documents and Settings\Administrator\Desktop\send1kMail.py, line 28,
 in SendEMAPIMail
outboxfolder = msgstore.OpenEntry(eid,None,mapi.MAPI_BEST_ACCESS)
TypeError: EntryID must be a string or None

Am I missing any additional components for WinXP?

The eid variable at line 27 has a value of -2147221233...

Thanks,
Varun

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Using win32com.mapi to automate mail dispatch...

2010-04-26 Thread Tim Roberts
Varun Avashia wrote:

  

 I tried to follow the code on this link
 http://mail.python.org/pipermail/python-win32/2004-August/002239.html

  

 This worked fine for me on win7 with Outlook2k7 (CDO were installed
 separately), However this failed to work on winxp with sp2 and
 outlook2k7 (with CDO installed) with following trace-back….

  

 Traceback (most recent call last):

   File C:\Documents and
 Settings\Administrator\Desktop\send1kMail.py, line 73,

  in module

 SendEMAPIMail(SendSubject, SendMessage, SendTo,
 MAPIProfile=MAPIProfile)

   File C:\Documents and
 Settings\Administrator\Desktop\send1kMail.py, line 28,

  in SendEMAPIMail

 outboxfolder = msgstore.OpenEntry(eid,None,mapi.MAPI_BEST_ACCESS)

 TypeError: EntryID must be a string or None

  

 Am I missing any additional components for WinXP?

  

 The eid variable at line 27 has a value of -2147221233…


For what it's worth, that's 0x8004010F, which is MAPI_E_NOT_FOUND.

You might want to print out the eid that you fetched in the line
immediately preceding.  Perhaps something went wrong with fetching the
outbox ID.  Has Outlook 2007 actually been configured for Administrator
on this machine?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Using win32com.mapi to automate mail dispatch...

2010-04-26 Thread Varun Avashia
Yes Tim, the user has Admin privileges, and eid has a -ve value of 
-2147221233.

-Original Message-
From: python-win32-bounces+varun.avashia=aryaka@python.org 
[mailto:python-win32-bounces+varun.avashia=aryaka@python.org] On Behalf Of 
Tim Roberts
Sent: Tuesday, April 27, 2010 4:22 AM
To: Python-Win32 List
Subject: Re: [python-win32] Using win32com.mapi to automate mail dispatch...

Varun Avashia wrote:

  

 I tried to follow the code on this link
 http://mail.python.org/pipermail/python-win32/2004-August/002239.html

  

 This worked fine for me on win7 with Outlook2k7 (CDO were installed
 separately), However this failed to work on winxp with sp2 and
 outlook2k7 (with CDO installed) with following trace-back….

  

 Traceback (most recent call last):

   File C:\Documents and
 Settings\Administrator\Desktop\send1kMail.py, line 73,

  in module

 SendEMAPIMail(SendSubject, SendMessage, SendTo,
 MAPIProfile=MAPIProfile)

   File C:\Documents and
 Settings\Administrator\Desktop\send1kMail.py, line 28,

  in SendEMAPIMail

 outboxfolder = msgstore.OpenEntry(eid,None,mapi.MAPI_BEST_ACCESS)

 TypeError: EntryID must be a string or None

  

 Am I missing any additional components for WinXP?

  

 The eid variable at line 27 has a value of -2147221233…


For what it's worth, that's 0x8004010F, which is MAPI_E_NOT_FOUND.

You might want to print out the eid that you fetched in the line
immediately preceding.  Perhaps something went wrong with fetching the
outbox ID.  Has Outlook 2007 actually been configured for Administrator
on this machine?

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32