MIMEMessage.h
上传用户:xmpantheon
上传日期:2016-10-20
资源大小:7502k
文件大小:2k
源码类别:

Email服务器

开发平台:

Visual C++

  1. // MIMEMessage.h: interface for the CMIMEMessage class.
  2. // Author: Wes Clyburn (clyburnw@enmu.edu)
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_MIMEMESSAGE_H__6233D556_EBBF_11D1_870E_444553540001__INCLUDED_)
  5. #define AFX_MIMEMESSAGE_H__6233D556_EBBF_11D1_870E_444553540001__INCLUDED_
  6. #if _MSC_VER >= 1000
  7. #pragma once
  8. #endif // _MSC_VER >= 1000
  9. #include <afxmt.h>
  10. #include "MailMessage.h"
  11. #include "MIMEContentAgent.h"
  12. // CMIMEMessage
  13. // Formats a message using the MIME specification.
  14. // 
  15. class CMIMEMessage : public CMailMessage  
  16. {
  17. public:
  18. CMIMEMessage();
  19. virtual ~CMIMEMessage();
  20. // MIME Type Codes
  21. enum eMIMETypeCode
  22. {
  23. TEXT_PLAIN = 0,
  24. APPLICATION_OCTETSTREAM,
  25. NEXT_FREE_MIME_CODE
  26. };
  27. enum eMIMEEncodingCode
  28. {
  29. _7BIT = 0,
  30. _8BIT,
  31. BINARY,
  32. QUOTED_PRINTABLE,
  33. BASE64,
  34. NEXT_FREE_ENCODING_CODE
  35. };
  36. BOOL AddMIMEPart( LPCTSTR szContent,
  37.   int nContentType = APPLICATION_OCTETSTREAM,
  38.   LPCTSTR szParameters = _T( "" ), 
  39.   int nEncoding = BASE64, 
  40.   BOOL bPath = TRUE );
  41. protected:
  42.     void insert_message_end( CString& sText );
  43. void register_mime_type( CMIMEContentAgent* pMIMEType );
  44. void insert_boundary( CString& sText );
  45. virtual void append_mime_parts();
  46. virtual void prepare_header();
  47. virtual void prepare_body();
  48. CString m_sNoMIMEText;
  49. CString m_sPartBoundary;
  50. CString m_sMIMEContentType;
  51. private:
  52. class CMIMEPart
  53. {
  54. public:
  55. int m_nEncoding;
  56. int m_nContentType;
  57. CString m_sParameters;
  58. BOOL m_bPath;
  59. CString m_sContent;
  60. };
  61. CList <CMIMEPart, CMIMEPart&> m_MIMEPartList;
  62. class CMIMETypeManager
  63. {
  64. public:
  65. CMIMEContentAgent* GetHandler( int nContentType );
  66. void RegisterMIMEType( CMIMEContentAgent* pMIMEType);
  67. virtual  ~CMIMETypeManager();
  68. CMIMETypeManager();
  69. private:
  70. CCriticalSection m_csAccess;
  71. CList < CMIMEContentAgent*, CMIMEContentAgent* > m_MIMETypeList;
  72. };
  73. static CMIMETypeManager m_MIMETypeManager;
  74. };
  75. #endif // !defined(AFX_MIMEMESSAGE_H__6233D556_EBBF_11D1_870E_444553540001__INCLUDED_)