Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
1.9 KiB

  1. // SendMail.h: interface for the CSendMail class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_SENDMAIL_H__C61A78A1_5B70_43EA_8F58_8D7600DE68BA__INCLUDED_)
  5. #define AFX_SENDMAIL_H__C61A78A1_5B70_43EA_8F58_8D7600DE68BA__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include <mapiutil.h>
  10. #include <mapix.h>
  11. #include <mapidbg.h>
  12. class CInitMapi
  13. {
  14. friend class CSendMail;
  15. friend class CAddressEnum;
  16. public:
  17. void DeInitMapi(void);
  18. HRESULT InitMapi(void);
  19. CInitMapi();
  20. virtual ~CInitMapi();
  21. protected:
  22. LPMAPISESSION pses;
  23. BOOL fMAPIInited;
  24. LPSPropValue pvalSentMailEID;
  25. LPMDB pmdb;
  26. LPADRBOOK pabAddrB;
  27. LPMAPIFOLDER pfldOutBox;
  28. private:
  29. static HRESULT HrOpenOutFolder(LPMAPISESSION pses, LPMDB pmdb, LPMAPIFOLDER FAR * lppF);
  30. static HRESULT HrOpenAddressBook(LPMAPISESSION pses, LPADRBOOK * ppAddrBook);
  31. static HRESULT HrOpenDefaultStore(LPMAPISESSION pses, LPMDB * ppmdb);
  32. };
  33. class CSendMail
  34. {
  35. public:
  36. HRESULT SetRecipients(LPSTR szRecipients);
  37. HRESULT CreateMail(LPSTR szSubject);
  38. HRESULT Transmit();
  39. CSendMail(CInitMapi &_mapi);
  40. virtual ~CSendMail();
  41. protected:
  42. CInitMapi & pmapi;
  43. LPMESSAGE pmsg;
  44. private:
  45. static HRESULT HrCreateAddrList(LPADRBOOK pabAddrB, LPADRLIST * ppal, LPSTR szToRecips);
  46. static HRESULT HrInitMsg(LPMESSAGE pmsg, LPSPropValue pvalSentMailEID, LPSTR szSubject);
  47. static HRESULT HrCreateOutMessage(LPMAPIFOLDER pfldOutBox, LPMESSAGE FAR * ppmM);
  48. };
  49. class CAddressEnum
  50. {
  51. public:
  52. HRESULT LookupAddress(LPSTR szInputName, LPSTR szResultBuffer, DWORD dwBufferSize);
  53. CAddressEnum(CInitMapi &_mapi);
  54. virtual ~CAddressEnum();
  55. protected:
  56. CInitMapi & pmapi;
  57. private:
  58. static HRESULT HrLookupSingleAddr(LPADRBOOK pabAddrB,
  59. LPSTR szInputName,
  60. LPSTR szResultBuffer, DWORD dwBufferSize);
  61. };
  62. #endif // !defined(AFX_SENDMAIL_H__C61A78A1_5B70_43EA_8F58_8D7600DE68BA__INCLUDED_)