SF #3538785: SMTPClientSession::sendMessage() should take recipient list

This commit is contained in:
Aleksandar Fabijanic
2012-07-23 04:32:26 +00:00
parent 0466c67ff2
commit d56a7a1ee6
7 changed files with 212 additions and 9 deletions

View File

@@ -69,7 +69,7 @@ class Net_API MailMessage: public MessageHeader
/// encodings are supported: 7bit, 8bit, quoted-printable
/// and base64.
{
public:
public:
typedef std::vector<MailRecipient> Recipients;
enum ContentDisposition
@@ -94,6 +94,9 @@ public:
void addRecipient(const MailRecipient& recipient);
/// Adds a recipient for the message.
void setRecipients(const Recipients& recipient);
/// Clears existing and sets new recipient list for the message.
const Recipients& recipients() const;
/// Returns the recipients of the message.

View File

@@ -59,6 +59,8 @@ class Net_API SMTPClientSession
/// client for sending e-mail messages.
{
public:
typedef std::vector<std::string> Recipients;
enum
{
SMTP_PORT = 25
@@ -130,7 +132,18 @@ public:
void sendMessage(const MailMessage& message);
/// Sends the given mail message by sending a MAIL FROM command,
/// a RCPT TO command for every recipient, and a DATA command with
/// the message headers and content.
/// the message headers and content. Using this function results in
/// RCPT TO commands list generated from the recipient list supplied
/// with the message itself.
///
/// Throws a SMTPException in case of a SMTP-specific error, or a
/// NetException in case of a general network communication failure.
void sendMessage(const MailMessage& message, const Recipients& recipients);
/// Sends the given mail message by sending a MAIL FROM command,
/// a RCPT TO command for every recipient, and a DATA command with
/// the message headers and content. Using this function results in
/// message header being generated from the supplied recipients list.
///
/// Throws a SMTPException in case of a SMTP-specific error, or a
/// NetException in case of a general network communication failure.
@@ -176,6 +189,9 @@ protected:
DialogSocket& socket();
private:
void sendCommands(const MailMessage& message, const Recipients* pRecipients = 0);
void transportMessage(const MailMessage& message);
DialogSocket _socket;
bool _isOpen;
};