2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE 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 SOPE 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 SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __NGMail_NGSmtpClient_H__
23 #define __NGMail_NGSmtpClient_H__
25 #import <Foundation/NSObject.h>
26 #import <NGStreams/NGStreams.h>
27 #import <NGStreams/NGSocketProtocols.h>
30 @class NGSmtpResponse;
35 This class implements the Simple Mail Transfer Protocol as specified in RFC821.
39 NGSmtpState_unconnected = 1,
40 NGSmtpState_connected,
41 NGSmtpState_TRANSACTION
44 @interface NGSmtpClient : NSObject
47 id<NGActiveSocket> socket;
48 NGBufferedStream *connection;
49 id<NGExtendedTextStream> text;
52 BOOL isDebuggingEnabled;
63 - (id)initWithSocket:(id<NGActiveSocket>)_socket; // designated initializer
67 - (id<NGActiveSocket>)socket;
70 - (void)setDebuggingEnabled:(BOOL)_flag;
71 - (BOOL)isDebuggingEnabled;
75 - (BOOL)connectToHost:(id)_host;
76 - (BOOL)connectToAddress:(id<NGSocketAddress>)_address;
81 - (void)requireState:(NGSmtpState)_state;
82 - (void)denyState:(NGSmtpState)_state;
83 - (void)gotoState:(NGSmtpState)_state;
87 - (NGSmtpResponse *)receiveReply;
91 - (NGSmtpResponse *)sendCommand:(NSString *)_command;
92 - (NGSmtpResponse *)sendCommand:(NSString *)_command argument:(NSString *)arg;
97 - (BOOL)helloWithHostname:(NSString *)_host;
103 - (NSString *)helpForTopic:(NSString *)_topic;
105 - (BOOL)verifyAddress:(id)_address;
107 // transaction commands
109 - (BOOL)mailFrom:(id)_sender;
110 - (BOOL)recipientTo:(id)_receiver;
111 - (BOOL)sendData:(NSData *)_data;
115 #endif /* __NGMail_NGSmtpClient_H__ */