📄 ckmailman.h
字号:
void put_LogMailReceivedFilename(const char *str);
// A filename where each message is logged in the form it is sent to the SMTP server.
// This property is provided for help in debugging. If the mail being sent via ChilkatMail
// is not received as expected, please send a problem report to support@chilkatsoft.com and
// include the email that was logged to this file.
void get_LogMailSentFilename(CkString &str);
void put_LogMailSentFilename(const char *str);
// Clears the list of bad email addresses that may have accumulated during SMTP mail sending.
// (see GetBadEmailAddresses below)
void ClearBadEmailAddresses(void);
// Returns a CkStringArray object containing the list of failed email addresses that have
// accumulated during SMTP sends. The list will not contain duplicates. Also, this only works
// with some SMTP servers -- not all SMTP servers check the validity of each email address.
CkStringArray *GetBadEmailAddresses(void);
// Returns the UIDLs of the emails currently stored on the POP3 server.
CkStringArray *GetUidls(void);
// Return true if the SMTP server is DSN capable
bool IsSmtpDsnCapable(void);
// Return true if login successful.
bool VerifySmtpLogin(void);
// Return true if connection is possible.
bool VerifySmtpConnection(void);
// Attempts to login to the POP server and returns true if successful, otherwise returns false.
bool VerifyPopLogin(void);
// Returns true if a connection can be made to the POP server, otherwise returns false.
bool VerifyPopConnection(void);
bool FetchMime(const char *uidl, CkByteData &mimeBytes);
// Given an array of UIDL strings, this method fetches all the emails from
// the POP3 server whose UIDL is present in the array, and returns the emails
// in a bundle. The fetched emails are not removed from the POP3 server.
CkEmailBundle *FetchMultiple(const CkStringArray *uidlArray);
CkEmailBundle *FetchMultiple(const CkStringArray &uidlArray) { return this->FetchMultiple(&uidlArray); }
CkStringArray *FetchMultipleMime(const CkStringArray *uidlArray);
CkStringArray *TransferMultipleMime(const CkStringArray *uidlArray);
CkStringArray *FetchMultipleMime(const CkStringArray &uidlArray) { return this->FetchMultipleMime(&uidlArray); }
CkStringArray *TransferMultipleMime(const CkStringArray &uidlArray) { return this->TransferMultipleMime(&uidlArray); }
// Given an array of UIDL strings, this method fetchs all the email headers from
// the POP3 server whose UIDL is present in the array.
// The fetched emails are not removed from the POP3 server.
CkEmailBundle *FetchMultipleHeaders(const CkStringArray *uidlArray, long numBodyLines);
CkEmailBundle *FetchMultipleHeaders(const CkStringArray &uidlArray, long numBodyLines) { return this->FetchMultipleHeaders(&uidlArray,numBodyLines); }
// Removes a single email from the server. Returns the a status code having one of the following values:
// -2 -- Failed to connect to the POP3 server.
// -1 -- Connected to the POP3 server, but failed to login or issue delete command
// 0 -- The UIDL was not found on the server.
// 1 -- The UIDL existed on the server and was deleted.
long DeleteByUidl(const char *uidl);
// Fetches an email from the POP3 server given its UIDL.
// The email is left on the POP3 server. A typical program might get
// the email headers from the POP3 server by calling GetAllHeaders or
// GetHeaders, and then fetch individual emails via their UIDL properties
// one at a time.
CkEmail *FetchEmail(const char *uidl);
// Removes from the POP3 server any email that has a UIDL equal to one of the
// UIDLs in the array.
bool DeleteMultiple(const CkStringArray *uidlArray);
bool DeleteMultiple(const CkStringArray &uidlArray) { return this->DeleteMultiple(&uidlArray); }
// Removes all the emails present in the bundle from the POP3 server.
bool DeleteBundle(const CkEmailBundle *bundle);
bool DeleteBundle(const CkEmailBundle &bundle) { return this->DeleteBundle(&bundle); }
// If a partial email was obtained using GetHeaders or GetAllHeaders, this function
// will take the partial email as an argument, and download the full email from the server.
// A new CkEmail object (separate from the partial email) is returned.
CkEmail *GetFullEmail(const CkEmail *email);
CkEmail *GetFullEmail(const CkEmail &email) { return this->GetFullEmail(&email); }
// The same as the GetAllHeaders method, except only the emails from fromIndex
// to toIndex on the POP3 server are returned. The first email on the server is at
// index 0.
CkEmailBundle *GetHeaders(long numBodyLines, long fromIndex, long toIndex);
// Removes an email from the POP3 server. The email argument is an email that was
// previously downloaded from the POP3 server, either in its entirety, or partially
// (as with GetAllHeaders or GetHeaders).
bool DeleteEmail(const CkEmail *email);
bool DeleteEmail(const CkEmail &email) { return this->DeleteEmail(&email); }
// Returns all the emails from the POP3 server, but only the first numBodyLines lines
// of the body. Attachments are not returned. The emails returned in the CkEmailBundle
// are valid CkEmail objects, the only difference is that the body is truncated to
// include only the top numBodyLines lines.
CkEmailBundle *GetAllHeaders(long numBodyLines);
// Loads from an XML string containing emails and returns an email bundle.
// If a Filter is present, only emails matching the filter are returned.
CkEmailBundle *LoadXmlString(const char *xmlString);
// Loads an XML file containing emails and returns an email bundle.
// If a Filter is present, only emails matching the filter are returned.
CkEmailBundle *LoadXmlFile(const char *folderPath);
// Loads an XML file containing a single email and returns a CkEmail object.
CkEmail *LoadXmlEmail(const char *folderPath);
bool MxLookup(const char *emailAddr, CkString &strHostname);
// Loads an XML string containing a single email and returns a CkEmail object
CkEmail *LoadXmlEmailString(const char *xmlString);
// A quick way to send an email to a single recipient without having to create a CkEmail object
// explicitly. Returns true on successful SMTP server handoff, and false if failed.
bool QuickSend(const char *from, const char *to, const char *subject, const char *body, const char *smtpServer);
bool UnlockComponent(const char *code);
// Return the number of messages available on the POP3 server.
// Returns -1 if unable to check the POP server for any reason.
long CheckMail(void);
// Transfer the emails from the POP3 server into a CkEmailBundle.
CkEmailBundle *TransferMail(void);
// Copy the mail from a POP3 server into a CkEmailBundle.
// This does not remove the email from the POP3 server.
CkEmailBundle *CopyMail(void);
// Sends multiple emails at once. Returns true if all emails were sent
// without errors, otherwise returns false. This is the same as
// looping over each email in a bundle and calling SendEmail for each.
bool SendBundle(const CkEmailBundle *bundle);
bool SendBundle(const CkEmailBundle &bundle) { return this->SendBundle(&bundle); }
// Send an email. Returns true if the hand-off to the SMTP server was
// successful for all recipients, otherwise returns false.
bool SendEmail(const CkEmail *email);
bool SendEmail(const CkEmail &email) { return this->SendEmail(&email); }
// Initiate the SMTP session as if sending email, passing the "RCPT TO" command
// to the SMTP server for each recipients, but abort the SMTP session prior to sending email.
// Any bad email addresses reported by the SMTP server are saved in saBadAddrs.
bool VerifyRecipients(const CkEmail &email, CkStringArray &saBadAddrs);
// Sends an email via the Chilkat smtpQ service. Returns true for success, false for failure.
bool SendQ(const CkEmail *email);
bool SendQ2(const CkEmail *email, const char *queueDir);
bool SendQ(const CkEmail &email) { return this->SendQ(&email); }
bool SendQ2(const CkEmail &email, const char *queueDir) { return this->SendQ2(&email,queueDir); }
// Loads a .mbx file containing emails and returns an email bundle.
// If a Filter is present, only emails matching the filter are returned.
CkEmailBundle *LoadMbx(const char *mbxFileName);
// Reads a .eml file returns it as a CkEmail object.
CkEmail *LoadEml(const char *emlFilename);
// Creates a CkEmail object from a MIME string.
CkEmail *LoadMime(const char *mimeText);
// Returns true if the component is unlocked.
bool IsUnlocked(void) const;
// When an email is sent by calling SendEmail, it is first "rendered" according to the values
// of the email properties and contents. It may be digitally signed, encrypted, values
// substituted for replacement patterns, and header fields "Q" or "B" encoded as needed based on
// the email. The RenderToMime method performs the rendering, but without the actual sending.
// The MIME text produced is exactly what would be sent to the SMTP server had SendEmail been
// called. (The SendEmail method is effectively the same as calling RenderToMime followed by a
// call to SendMime.)
bool RenderToMime(const CkEmail *email, CkString &str);
bool RenderToMime(const CkEmail &email, CkString &str) { return this->RenderToMime(&email,str); }
bool SendMime(const char *from, const char *recipients, const char *mimeMsg);
bool SendMimeQ(const char *from, const char *recipients, const char *mimeMsg);
bool OpenSmtpConnection(void);
bool CloseSmtpConnection(void);
bool SmtpReset(void);
bool SmtpNoop(void);
bool GetMailboxInfoXml(CkString &xml);
void get_SmtpSessionLog(CkString &log);
void ClearSmtpSessionLog(void);
const char *smtpSessionLog(void);
void SetProgressCallback(CkMailProgress *cb) { m_callback = cb; }
CkString m_resultString;
const char *lastErrorText(void);
const char *lastErrorXml(void);
const char *lastErrorHtml(void);
const char *smtpPassword(void);
const char *smtpUsername(void);
const char *dsnNotify(void);
const char *dsnEnvid(void);
const char *dsnRet(void);
const char *smtpAuthMethod(void);
const char *smtpLoginDomain(void);
const char *filter(void);
const char *popPassword(void);
const char *popUsername(void);
const char *mailHost(void);
const char *heloHostname(void);
const char *lastSendQFilename(void);
const char *version(void);
const char *smtpHost(void);
const char *logMailReceivedFilename(void);
const char *logMailSentFilename(void);
const char *mxLookup(const char *emailAddr);
const char *renderToMime(const CkEmail &email);
const char *getMailboxInfoXml(void);
// END PUBLIC INTERFACE
private:
// Internal implementation.
void *m_impl;
bool m_utf8; // If true, all input "const char *" parameters are utf-8, otherwise they are ANSI strings.
CkMailProgress *m_callback;
// Don't allow assignment or copying these objects.
CkMailMan(const CkMailMan &) { }
CkMailMan &operator=(const CkMailMan &) { return *this; }
CkMailMan(void *impl) : m_callback(0),m_impl(impl) { }
public:
void *getImpl(void) const { return m_impl; }
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -