ckemail.h

来自「DES加密解密算法,西望大家共享.参考学习」· C头文件 代码 · 共 710 行 · 第 1/3 页

H
710
字号

	// IMPORTANT: Unless otherwise noted, strings are always passed/returned in the utf-8 character encoding.
	void get_Mailer(CkString &str);
	void put_Mailer(const char *str);

	// The raw email header.
	void get_Header(CkString &str);

	long get_NumBcc(void);
	long get_NumCC(void);
	long get_NumTo(void);

	// The full from name + address.
	void get_From(CkString &str);
	void put_From(const char *str);

	// IMPORTANT: Unless otherwise noted, strings are always passed/returned in the utf-8 character encoding.
	// If the header field was B or Q encoded, it is automatically decoded before being returned.
	// When setting the subject, the input string may be utf-8 or optionally B- or Q-encoded.
	void get_Subject(CkString &str);
	void put_Subject(const char *str);

	// IMPORTANT: Unless otherwise noted, strings are always passed/returned in the utf-8 character encoding.
	void get_ReplyTo(CkString &str);
	void put_ReplyTo(const char *str);

	// IMPORTANT: Unless otherwise noted, strings are always passed/returned in the utf-8 character encoding.
	void get_BounceAddress(CkString &str);
	void put_BounceAddress(const char *str);

	// The default email body.  
	void get_Body(CkString &str);
	void put_Body(const char *str);

	// True if the caller email has a UIDL that equals the email passed in the parameter.
	bool UidlEquals(const CkEmail *e);
	bool UidlEquals(const CkEmail &e) { return UidlEquals(&e); }

	// Saves the email to a temporary MHT file so that a WebBrowser control can navigate to it and 
	// display it. If fileName is empty, a temporary filename is generated and this filename is returned.
	// If fileName is non-empty, then that file will be created or overwritten, and the input filename 
	// is simply returned.
	// The MHT file that is created will not contain any of the email's attachments, if any existed. 
	// Also, if the email was plain-text, the MHT file will be saved such that the plain-text is 
	// converted to HTML using pre-formatted text (<pre> HTML tags) allowing it to be displayed correctly
	// in a WebBrowser.
	bool CreateTempMht(const char *inFilename, CkString &tempMhtFilenameInOut);

	CkMime *GetMimeObject(void);

	// Error log retrieval and saving (these methods are common to all Chilkat VC++ classes.)
	bool SaveLastError(const char *filename);
        void LastErrorXml(CkString &str);
        void LastErrorHtml(CkString &str);
        void LastErrorText(CkString &str);


	// Sets the plain-text email body from a byte array containing character data in the 
	// specified character set. This method also updates the email "content-type" header to properly 
	// reflect the content type of the body.
    	bool SetMbPlainTextBody(const char *charset, const unsigned char *data, unsigned long dataLen);

	// Sets the HTML email body from a byte array containing character data in the specified 
	// character set. This method also updates the email "content-type" header to properly reflect 
	// the content type of the body. 
    	bool SetMbHtmlBody(const char *charset, const unsigned char *data, unsigned long dataLen);

	// Returns the plain-text body converted to a specified charset. 
	// The return value is a byte array containing multibyte character data.
	bool GetMbPlainTextBody(const char *charset, CkByteData &data);

	// Returns the HTML body converted to a specified charset. If no HTML body exists, the returned byte 
	// array is empty. The returned data will be such that not only is the character data converted 
	// (if necessary) to the convertToCharset, but the HTML is edited to add or modify the META tag 
	// that specifies the charset within the HTML.
	bool GetMbHtmlBody(const char *charset, CkByteData &data);

	// Returns a header field's raw data in a byte array. If the field was Q or B encoded, this is 
	// automatically decoded, and the raw bytes of the field are returned. Call GetHeaderField to 
	// retrieve the header field as a utf-8 string.
	bool GetMbHeaderField(const char *fieldName, CkByteData &fieldData);

	// Same as GetMbHeaderField, except the field value is converted to the charset specified.
	// If conversion is not possible, then utf-8 is returned and the method returns false.
	bool GetMbHeaderField2(const char *charset, const char *fieldName, CkByteData &fieldData);

	// Takes a byte array of multibyte character data having the character encoding specified by the charset parameter, 
	// and returns a us-ascii Q-Encoded string. 
	bool QEncodeBytes(const unsigned char *data, unsigned long dataLen, const char *charset, CkString &encodedStr);
	// Takes a byte array of multibyte character data having the character encoding specified by the charset parameter, 
	// and returns a us-ascii B-Encoded string. 
	bool BEncodeBytes(const unsigned char *data, unsigned long dataLen, const char *charset, CkString &encodedStr);
	// Takes a utf-8 string, converts it to the charset specified in the 2nd parameter, B-Encodes the converted multibyte data, 
	// and returns the Q-encoded us-ascii string.
	bool QEncodeString(const char *str, const char *charset, CkString &encodedStr);
	// Takes a utf-8 string, converts it to the charset specified in the 2nd parameter, B-Encodes the converted multibyte data, 
	// and returns the B-encoded us-ascii string.
	bool BEncodeString(const char *str, const char *charset, CkString &encodedStr);

	// This, or CkMailMan::UnlockComponent, should be called once at the beginning of the program.  
	bool UnlockComponent(const char *unlockCode);

	// Number of embedded email messages attached to this email.
	long get_NumAttachedMessages(void);

	// Retrieves one of the emails (if any) attached to the calling email object. 
	// Indexing begins at 0. Returns the attached email as a full email object which may contain 
	// additional attached emails.
	CkEmail *GetAttachedMessage(long index);

	// Remove all attached messages.
	void RemoveAttachedMessages(void);
	// Remove the Nth attached message.
	void RemoveAttachedMessage(long index);

	// Return the linked domains found in the email.
	void GetLinkedDomains(CkStringArray &array);

	// Un-obfuscate what spammers do to obfuscate HTML emails.
	void UnSpamify(void);

	// Return true if this email is a multipart/report type email.  Multipart/report emails are
	// typically bounced email notifications.
	bool IsMultipartReport(void);

	// Return true if this email has an HTML body.
	bool HasHtmlBody(void);

	// Return true if this email has a plain-text body.
	bool HasPlainTextBody(void);

	// Removes the path information from attachment filenames so that 
	// the attachments are simply a filename with extension.
	// Example:  c:\myDirectory\myAttachment.txt  -->  myAttachment.txt
	void RemoveAttachmentPaths(void);



	bool UnpackHtml(const char *unpackDir, const char *htmlFilename, const char *partsSubdir);


	bool get_Utf8(void) const;
	void put_Utf8(bool b);

	CkString m_resultString;
        const char *lastErrorText(void);
        const char *lastErrorXml(void);
        const char *lastErrorHtml(void);

	const char *getRelatedStringCrLf(long index, const char *charset);
	const char *getRelatedContentID(long index);
	const char *getRelatedContentType(long index);
	const char *getRelatedFilename(long index);
	const char *getRelatedString(long index, const char *charset);
	const char *getAlternativeBody(long index);
	const char *getAlternativeContentType(long index);
	const char *getHtmlBody(void);
	const char *getPlainTextBody(void);
	const char *getHeaderFieldName(long index);
	const char *getHeaderFieldValue(long index);
	const char *getAttachmentStringCrLf(long index, const char *charset);
	const char *getAttachmentContentID(long index);
	const char *getAttachmentContentType(long index);
	const char *getAttachmentHeader(long index, const char *fieldName);
	const char *getAttachmentString(long index, const char *charset);
	const char *getAttachmentFilename(long index);
	const char *getHeaderField(const char *fieldName);
	const char *getBcc(long index);
	const char *getCC(long index);
	const char *getTo(long index);
	const char *getBccAddr(long index);
	const char *getCcAddr(long index);
	const char *getToAddr(long index);
	const char *getBccName(long index);
	const char *getCcName(long index);
	const char *getToName(long index);
	const char *getMime(void);
	const char *getXml(void);
	const char *uidl(void);
	const char *charset(void);
	const char *encryptedBy(void);
	const char *signedBy(void);
	const char *fromAddress(void);
	const char *fromName(void);
	const char *mailer(void);
	const char *header(void);
	const char *ck_from(void);
	const char *subject(void);
	const char *replyTo(void);
	const char *bounceAddress(void);
	const char *body(void);
	const char *qEncodeString(const char *str, const char *charset);
	const char *bEncodeString(const char *str, const char *charset);

	const char *getReplaceString2(const char *pattern);
	const char *getReplaceString(long index);
	const char *getReplacePattern(long index);
	const char *generateFilename(void);
	const char *fileDistList(void);
	const char *createTempMht(const char *inFilename);
	const char *qEncodeBytes(const unsigned char *data, unsigned long dataLen, const char *charset);
	const char *bEncodeBytes(const unsigned char *data, unsigned long dataLen, const char *charset);

	const char *addFileAttachment(const char *fileName);
	const char *addRelatedFile(const char *fileName);
	const char *addRelatedString(const char *nameInHtml, const char *str, const char *charset);

	// END PUBLIC INTERFACE


    private:
	// Internal implementation.
	bool m_utf8;	// If true, all input "const char *" parameters are utf-8, otherwise they are ANSI strings.
	bool m_ownership;
	void *m_impl;

	// Don't allow assignment or copying these objects.
	CkEmail(const CkEmail &) { } 
	CkEmail &operator=(const CkEmail &) { return *this; }
	CkEmail(void *impl) : m_impl(impl) { }

    public:
	// For internal use only.
	void *getImpl(void) const;

	CkEmail(void *impl, bool ownership) : m_impl(impl), m_ownership(ownership) { }



};




#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?