[ SimpleEmailClient | Source | Keywords | Summary | Ancestors | All Members | Descendants ]
Back to the top of CSimpleSMTPClient
This class provides a simple API to send Internet Emails via the Simple Mail Transfer Protocol (SMTP).
This class succeeded in sending email messages to the following SMTP servers:
Back to the top of CSimpleSMTPClient
To use this class:
Back to the top of CSimpleSMTPClient
// Create instance CSimpleSMTPClient oSMTPClient("smtp.mydomain.com");HRESULT hResult = oSMTPClient.SendEmail("me@mydomain.com", "you@yourdomain.com", "This is my subject...", "This is the body text..."); if (FAILED(hResult)) {
// Log error
[...]
} else {
// Email sent successfully
[...]
}
Back to the top of CSimpleSMTPClient
Author Emmanuel KARTMANN
Date Tuesday 11/17/98
Back to the top of CSimpleSMTPClient
CSimpleSocket CSocket RFC822 RFC821
Back to the top of CSimpleSMTPClient
CSimpleSMTPClient(LPCTSTR lpszSMTPServerNames, UINT uPortNumber , UINT uTimeOut );
Purpose: create an instance of the class
Parameters:
Description :
CSimpleSMTPClient(LPCTSTR lpszSMTPServerNames, UINT uPortNumber = 25, UINT uTimeOut = 30000);
Back to the top of CSimpleSMTPClient
Purpose: delete an instance of the class
Parameters: none (C++ destructor)
Return value : none (C++ destructor)
Description :
virtual ~CSimpleSMTPClient();
Back to the top of CSimpleSMTPClient
HRESULT SendEmail(LPCTSTR lpszFrom, LPCTSTR lpszTo, LPCTSTR lpszSubject, LPCTSTR lpszBody);
Purpose: send an email message (via SMTP)
Parameters:
Description : This function tries to send the email message using all known SMTP servers (see constructor). It calls function SendEmailToServer() until one server accepts to deliver the email message.
HRESULT SendEmail(LPCTSTR lpszFrom, LPCTSTR lpszTo, LPCTSTR lpszSubject, LPCTSTR lpszBody);
Back to the top of CSimpleSMTPClient
CString GetLastErrorMessage(void);
Purpose: returns the last error message
Parameters: none
Return value : CString = last error message
Description : CAUTION: the current implementation is not thread-safe (there's only one message per class instance; you should not share the class instance between threads).
CString GetLastErrorMessage(void);
Back to the top of CSimpleSMTPClient
BOOL BuildListFromString(LPCTSTR lpszStringWithSeparators, CStringList &oList);
Purpose: Builds a CStringList object with a string containing separators (e.g. list of SMTP addresses separated by commas ',')
Parameters:
Description : The separator is either a comma (',') or a semicolon (';').
BOOL BuildListFromString(LPCTSTR lpszStringWithSeparators, CStringList &oList);
Back to the top of CSimpleSMTPClient
CString BuildStringFromList(CStringList &oList, LPCTSTR lpszSeparator);
Purpose: Builds a string containing separators with a CStringList object with a string (e.g. list of SMTP addresses separated by commas ',')
Parameters:
Description :
CString BuildStringFromList(CStringList &oList, LPCTSTR lpszSeparator);
Back to the top of CSimpleSMTPClient
CString BuildRFC822Address(LPCTSTR lpszAddress);
Purpose: builds a RFC822 address from a plain string
Parameters:
Description : If the parameter is already an RFC822 address,
(e.g. "Emmanuel KARTMANN
Back to the top of CSimpleSMTPClient
Purpose: extract an SMTP address from a full RFC822 address
Parameters:
Description : This function extracts everything between
'<' and '>' in the input string. It's used
because some SMTP servers reject full addresses.
Back to the top of CSimpleSMTPClient
Purpose: return the fully qualified IP name of the local
machine.
Parameters:
Description : The IP name is used as part of the SMTP
protocol (in the "HELO" line).
Back to the top of CSimpleSMTPClient
Purpose: send an email message (via SMTP)
Parameters:
Description : -
Back to the top of CSimpleSMTPClient Back to the top of CSimpleSMTPClient
Back to the top of CSimpleSMTPClient
Back to the top of CSimpleSMTPClient
CString BuildRFC822Address(LPCTSTR lpszAddress);
CString ExtractSMTPAddress(LPCTSTR lpszAddress);
Return value : CString = SMTP address (e.g. "emmanuel@kartmann.com")
CString ExtractSMTPAddress(LPCTSTR lpszAddress);
BOOL GetHostName(CString &szFullyQualifiedHostName);
Return value : BOOL = TRUE for success, FALSE otherwise
BOOL GetHostName(CString &szFullyQualifiedHostName);
Return value : HRESULT = S_OK (0) for success
HRESULT SendEmailToServer(LPCTSTR lpszServerName, LPCTSTR lpszFrom, LPCTSTR lpszTo, LPCTSTR lpszSubject, LPCTSTR lpszBody);
All Members
Ancestors
Class does not inherit from any other class.Descendants
Class is not inherited by any others.
Generated from source by the Cocoon utilities on Tue Feb 08 17:47:03 2000
.