/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/util/simplemapi.py

  • Committer: Jelmer Vernooij
  • Date: 2017-06-10 02:09:46 UTC
  • mto: This revision was merged to the branch mainline in revision 6690.
  • Revision ID: jelmer@jelmer.uk-20170610020946-nxnwagf535b3lctb
Move breezy.repofmt contents to  breezy.bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
software, please contact me at the above email address.
37
37
"""
38
38
 
 
39
from __future__ import absolute_import
 
40
 
39
41
import os
40
42
from ctypes import *
41
43
 
156
158
    pSession = LHANDLE()
157
159
    rc = MAPILogon(0, profileName, password, MAPI_LOGON_UI, 0, byref(pSession))
158
160
    if rc != SUCCESS_SUCCESS:
159
 
        raise MAPIError, rc
 
161
        raise MAPIError(rc)
160
162
    return pSession
161
163
 
162
164
 
163
165
def _logoff(session):
164
166
    rc = MAPILogoff(session, 0, 0, 0)
165
167
    if rc != SUCCESS_SUCCESS:
166
 
        raise MAPIError, rc
 
168
        raise MAPIError(rc)
167
169
 
168
170
 
169
171
def _resolveName(session, name):
170
172
    pRecipDesc = lpMapiRecipDesc()
171
173
    rc = MAPIResolveName(session, 0, name, 0, 0, byref(pRecipDesc))
172
174
    if rc != SUCCESS_SUCCESS:
173
 
        raise MAPIError, rc
 
175
        raise MAPIError(rc)
174
176
    rd = pRecipDesc.contents
175
177
    name, address = rd.lpszName, rd.lpszAddress
176
178
    rc = MAPIFreeBuffer(pRecipDesc)
177
179
    if rc != SUCCESS_SUCCESS:
178
 
        raise MAPIError, rc
 
180
        raise MAPIError(rc)
179
181
    return name, address
180
182
 
181
183
 
217
219
 
218
220
    rc = MAPISendMail(session, 0, byref(msg), MAPI_DIALOG, 0)
219
221
    if rc != SUCCESS_SUCCESS:
220
 
        raise MAPIError, rc
 
222
        raise MAPIError(rc)
221
223
 
222
224
 
223
225
def SendMail(recipient, subject="", body="", attachfiles=""):
231
233
 
232
234
    attach = []
233
235
    AttachWork = attachfiles.split(';')
234
 
    for file in AttachWork:
235
 
        if os.path.exists(file):
236
 
            attach.append(file)
237
 
    attach = map(os.path.abspath, attach)
 
236
    for f in AttachWork:
 
237
        if os.path.exists(f):
 
238
            attach.append(os.path.abspath(f))
238
239
 
239
240
    restore = os.getcwd()
240
241
    try: