added SMTP auth support contributed by TAC

This commit is contained in:
Guenter Obiltschnig
2008-04-15 10:58:16 +00:00
parent 898045b4eb
commit dc9fb44829
2 changed files with 153 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
//
// SMTPClientSession.h
//
// $Id: //poco/svn/Net/include/Poco/Net/SMTPClientSession.h#2 $
// $Id: //poco/Main/Net/include/Poco/Net/SMTPClientSession.h#4 $
//
// Library: Net
// Package: Mail
@@ -9,7 +9,7 @@
//
// Definition of the SMTPClientSession class.
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// Copyright (c) 2005-2008, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
@@ -63,6 +63,13 @@ public:
SMTP_PORT = 25
};
enum LoginMethod
{
AUTH_NONE,
AUTH_CRAM_MD5,
AUTH_LOGIN,
};
SMTPClientSession(const StreamSocket& socket);
/// Creates the SMTPClientSession using
/// the given socket, which must be connected
@@ -94,6 +101,10 @@ public:
void login();
/// Calls login(hostname) with the current host name.
void login(LoginMethod loginMethod, const std::string& username, const std::string& password);
/// Logs in to the SMTP server using the given authentication method and the given
/// credentials.
void open();
/// Reads the initial response from the SMTP server.
///
@@ -149,6 +160,11 @@ protected:
static bool isTransientNegative(int status);
static bool isPermanentNegative(int status);
void login(const std::string& hostname, std::string& response);
void loginUsingCRAM_MD5(const std::string& username, const std::string& password);
void loginUsingLogin(const std::string& username, const std::string& password);
void loginUsingPlain(const std::string& username, const std::string& password);
private:
DialogSocket _socket;
bool _isOpen;