~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/util/simplemapi.py

(jameinel) Allow 'bzr serve' to interpret SIGHUP as a graceful shutdown.
 (bug #795025) (John A Meinel)

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
 
181
181
 
182
182
def _sendMail(session, recipient, subject, body, attach):
183
183
    nFileCount = len(attach)
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 
 
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
194
194
        lpFiles = fda
195
195
    else:
196
196
        lpFiles = lpMapiFileDesc()
197
197
 
198
198
    RecipWork = recipient.split(';')
199
199
    RecipCnt = len(RecipWork)
200
 
    MapiRecipDesc_A = MapiRecipDesc * len(RecipWork) 
201
 
    rda = MapiRecipDesc_A() 
 
200
    MapiRecipDesc_A = MapiRecipDesc * len(RecipWork)
 
201
    rda = MapiRecipDesc_A()
202
202
    for rd, ra in zip(rda, RecipWork):
203
 
        rd.ulReserved = 0 
 
203
        rd.ulReserved = 0
204
204
        rd.ulRecipClass = MAPI_TO
205
205
        try:
206
206
            rd.lpszName, rd.lpszAddress = _resolveName(session, ra)
222
222
 
223
223
def SendMail(recipient, subject="", body="", attachfiles=""):
224
224
    """Post an e-mail message using Simple MAPI
225
 
    
 
225
 
226
226
    recipient - string: address to send to (multiple addresses separated with a semicolon)
227
227
    subject   - string: subject header
228
228
    body      - string: message text