2 Copyright (C) 2000-2003 SKYRIX Software AG
4 This file is part of OGo
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #ifndef __NGMail_NGSmtpClient_H__
24 #define __NGMail_NGSmtpClient_H__
26 #import <Foundation/NSObject.h>
27 #import <NGStreams/NGStreams.h>
28 #import <NGStreams/NGSocketProtocols.h>
31 @class NGSmtpResponse;
36 This class implements the Simple Mail Transfer Protocol as specified in RFC821.
40 NGSmtpState_unconnected = 1,
41 NGSmtpState_connected,
42 NGSmtpState_TRANSACTION
45 @interface NGSmtpClient : NSObject
48 id<NGActiveSocket> socket;
49 NGBufferedStream *connection;
50 id<NGExtendedTextStream> text;
53 BOOL isDebuggingEnabled;
64 - (id)initWithSocket:(id<NGActiveSocket>)_socket; // designated initializer
68 - (id<NGActiveSocket>)socket;
71 - (void)setDebuggingEnabled:(BOOL)_flag;
72 - (BOOL)isDebuggingEnabled;
76 - (BOOL)connectToHost:(id)_host;
77 - (BOOL)connectToAddress:(id<NGSocketAddress>)_address;
82 - (void)requireState:(NGSmtpState)_state;
83 - (void)denyState:(NGSmtpState)_state;
84 - (void)gotoState:(NGSmtpState)_state;
88 - (NGSmtpResponse *)receiveReply;
92 - (NGSmtpResponse *)sendCommand:(NSString *)_command;
93 - (NGSmtpResponse *)sendCommand:(NSString *)_command argument:(NSString *)arg;
98 - (BOOL)helloWithHostname:(NSString *)_host;
104 - (NSString *)helpForTopic:(NSString *)_topic;
106 - (BOOL)verifyAddress:(id)_address;
108 // transaction commands
110 - (BOOL)mailFrom:(id)_sender;
111 - (BOOL)recipientTo:(id)_receiver;
112 - (BOOL)sendData:(NSData *)_data;
116 #endif /* __NGMail_NGSmtpClient_H__ */