~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/util/simplemapi.py

  • Committer: John Arbash Meinel
  • Author(s): Mark Hammond
  • Date: 2008-09-09 17:02:21 UTC
  • mto: This revision was merged to the branch mainline in revision 3697.
  • Revision ID: john@arbash-meinel.com-20080909170221-svim3jw2mrz0amp3
An updated transparent icon for bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
Origin  : Based on the original script by Ian Cook
29
29
          http://www.kirbyfooty.com/simplemapi.py
30
30
Comments: Works (and tested) with:
31
 
          Outlook Express, Outlook 97 and 2000,
 
31
          Outlook Express, Outlook 97 and 2000, 
32
32
          Eudora, Incredimail and Mozilla Thunderbird (1.5.0.2)
33
33
Thanks  : Werner F. Bruhin and Michele Petrazzo on the ctypes list.
34
34
 
35
 
If you have any bug-fixes, enhancements or suggestions regarding this
 
35
If you have any bug-fixes, enhancements or suggestions regarding this 
36
36
software, please contact me at the above email address.
37
37
"""
38
38
 
39
 
from __future__ import absolute_import
40
 
 
41
39
import os
42
40
from ctypes import *
43
41
 
183
181
 
184
182
def _sendMail(session, recipient, subject, body, attach):
185
183
    nFileCount = len(attach)
186
 
    if attach:
187
 
        MapiFileDesc_A = MapiFileDesc * len(attach)
188
 
        fda = MapiFileDesc_A()
189
 
        for fd, fa in zip(fda, attach):
190
 
            fd.ulReserved = 0
191
 
            fd.flFlags = 0
192
 
            fd.nPosition = -1
193
 
            fd.lpszPathName = fa
194
 
            fd.lpszFileName = None
195
 
            fd.lpFileType = None
 
184
    if attach: 
 
185
        MapiFileDesc_A = MapiFileDesc * len(attach) 
 
186
        fda = MapiFileDesc_A() 
 
187
        for fd, fa in zip(fda, attach): 
 
188
            fd.ulReserved = 0 
 
189
            fd.flFlags = 0 
 
190
            fd.nPosition = -1 
 
191
            fd.lpszPathName = fa 
 
192
            fd.lpszFileName = None 
 
193
            fd.lpFileType = None 
196
194
        lpFiles = fda
197
195
    else:
198
196
        lpFiles = lpMapiFileDesc()
199
197
 
200
198
    RecipWork = recipient.split(';')
201
199
    RecipCnt = len(RecipWork)
202
 
    MapiRecipDesc_A = MapiRecipDesc * len(RecipWork)
203
 
    rda = MapiRecipDesc_A()
 
200
    MapiRecipDesc_A = MapiRecipDesc * len(RecipWork) 
 
201
    rda = MapiRecipDesc_A() 
204
202
    for rd, ra in zip(rda, RecipWork):
205
 
        rd.ulReserved = 0
 
203
        rd.ulReserved = 0 
206
204
        rd.ulRecipClass = MAPI_TO
207
205
        try:
208
206
            rd.lpszName, rd.lpszAddress = _resolveName(session, ra)
224
222
 
225
223
def SendMail(recipient, subject="", body="", attachfiles=""):
226
224
    """Post an e-mail message using Simple MAPI
227
 
 
 
225
    
228
226
    recipient - string: address to send to (multiple addresses separated with a semicolon)
229
227
    subject   - string: subject header
230
228
    body      - string: message text