1/* 2 * Copyright 2007-2015, Haiku Inc. All Rights Reserved. 3 * Copyright 2001-2002 Dr. Zoidberg Enterprises. All rights reserved. 4 * Copyright 2011, Clemens Zeidler <haiku@clemens-zeidler.de> 5 * 6 * Distributed under the terms of the MIT License. 7 */ 8#ifndef SMTP_H 9#define SMTP_H 10 11 12#include <String.h> 13 14#include <MailFilter.h> 15#include <MailProtocol.h> 16#include <MailSettings.h> 17 18 19class BSocket; 20 21 22class SMTPProtocol : public BOutboundMailProtocol { 23public: 24 SMTPProtocol( 25 const BMailAccountSettings& settings); 26 virtual ~SMTPProtocol(); 27 28protected: 29 status_t Connect(); 30 void Disconnect(); 31 32 virtual status_t HandleSendMessages(const BMessage& message, 33 off_t totalBytes); 34 35 status_t Open(const char *server, int port, bool esmtp); 36 void Close(); 37 status_t Login(const char *uid, const char *password); 38 status_t Send(const char *to, const char *from, 39 BPositionIO *message); 40 41 int32 ReceiveResponse(BString &line); 42 status_t SendCommand(const char *cmd); 43 44private: 45 status_t _SendMessage(const entry_ref& ref); 46 status_t _POP3Authentication(); 47 48 BSocket* fSocket; 49 BString fLog; 50 BMessage fSettingsMessage; 51 int32 fAuthType; 52 53 bool use_ssl; 54 55 status_t fStatus; 56 BString fServerName; // required for DIGEST-MD5 57}; 58 59 60#endif // SMTP_H 61