1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27
28#ifndef __com_sun_star_mail_XMailServer_idl__
29#define __com_sun_star_mail_XMailServer_idl__
30
31#ifndef __com_sun_star_uno_XInterface_idl__
32#include <com/sun/star/uno/XInterface.idl>
33#endif
34
35#ifndef __com_sun_star_mail_XAuthenticator_idl__
36#include <com/sun/star/mail/XAuthenticator.idl>
37#endif
38
39#ifndef __com_sun_star_mail_XMailMessage_idl__
40#include <com/sun/star/mail/XMailMessage.idl>
41#endif
42
43#ifndef __com_sun_star_auth_AuthenticationFailedException_idl__
44#include <com/sun/star/auth/AuthenticationFailedException.idl>
45#endif
46
47#ifndef __com_sun_star_io_AlreadyConnectedException_idl__
48#include <com/sun/star/io/AlreadyConnectedException.idl>
49#endif
50
51#ifndef __com_sun_star_io_NotConnectedException_idl__
52#include <com/sun/star/io/NotConnectedException.idl>
53#endif
54
55#ifndef __com_sun_star_io_UnknownHostException_idl__
56#include <com/sun/star/io/UnknownHostException.idl>
57#endif
58
59#ifndef __com_sun_star_io_NoRouteToHostException_idl__
60#include <com/sun/star/io/NoRouteToHostException.idl>
61#endif
62
63#ifndef __com_sun_star_io_ConnectException_idl__
64#include <com/sun/star/io/ConnectException.idl>
65#endif
66
67#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
68#include <com/sun/star/lang/IllegalArgumentException.idl>
69#endif
70
71#ifndef __com_sun_star_ucb_InteractiveIOException_idl__
72#include <com/sun/star/ucb/InteractiveIOException.idl>
73#endif
74
75#ifndef __com_sun_star_mail_MailException_idl__
76#include <com/sun/star/mail/MailException.idl>
77#endif
78
79#ifndef __com_sun_star_mail_SendMailMessageFailedException_idl__
80#include <com/sun/star/mail/SendMailMessageFailedException.idl>
81#endif
82
83#ifndef __com_sun_star_mail_XConnectionListener_idl__
84#include <com/sun/star/mail/XConnectionListener.idl>
85#endif
86
87#ifndef __com_sun_star_datatransfer_UnsupportedFlavorException_idl__
88#include <com/sun/star/datatransfer/UnsupportedFlavorException.idl>
89#endif
90
91module com { module sun { module star { module mail {
92
93/**
94   Represents a mail server abstraction.
95
96   @see com::sun::star::mail::XMailMessage
97
98   @since OOo 2.0
99 */
100interface XMailServer: ::com::sun::star::uno::XInterface {
101
102    /**
103        The complete domain name of the mail server.
104    */
105    [attribute, readonly] string Name;
106
107    /**
108        The port number that will be used to connect to the mail server.
109        If no port number has been set the default port number 25 will
110        be used.
111    */
112    [attribute] long Port;
113
114    /**
115        Returns all connection types which are supported by the
116        mail server. Possible connection types are for instance
117        secure connections like 'SSL' or 'TLS'.
118
119        @returns
120        a sequence of supported connection types.
121    */
122    sequence<string> getSupportedConnectionTypes();
123
124    /**
125        Set the connection type that will be used to connect to the
126        mail server. The supported connection types may be queried
127        using <code>getSupportedConnectionTypes()</code>.
128        If no connection types has explicitly been set the default
129        connection type will be used.
130
131        @param sConnectionType
132        [in] identifies the connection that should be used to connect
133        to the mail server.
134
135        @throws com::sun::star::lang::IllegalArgumentException
136        if the provided connection type is not supported.
137
138        @see getSupportedConnectionTypes
139        @see isConnectionTypeSupported
140    */
141    void setConnectionType([in] string sConnectionType)
142        raises (com::sun::star::lang::IllegalArgumentException);
143
144    /**
145        Allow a client to query if a certain connection type is
146        supported.
147
148        @param sConnectionType
149        [in] query if a certain connection type is supported.
150
151        @returns
152        <TRUE/> if the specified connection type is supported.
153    */
154    boolean isConnectionTypeSupported([in] string sConnectionType);
155
156    /**
157        Register a connection listener.
158
159        @param xListener
160        [in] a listener that will be informed about connection events.
161
162        @see com::sun::star::mail::XConnectionListener
163    */
164    void addConnectionListener([in] XConnectionListener xListener);
165
166    /**
167        Unregister a connection listener.
168
169        @param xListener
170        [in] a listener that no longer need to be informed about connection events.
171
172        @see com::sun::star::mail::XConnectionListener
173    */
174    void removeConnectionListener([in] XConnectionListener xListener);
175
176    /**
177        Login a user to the mail server. Only one user may logged in
178        at a time. An attempt to login while another user is logged in
179        causes an exception to be thrown.
180
181        @param xAuthenticator
182        [in] an interface used to query for the necessary user information
183        needed to login to the mail server.
184
185        @throws com::sun::star::io::AlreadyConnectedException
186        on a try to connect to an already connect mail server.
187
188        @throws com::sun::star::io::UnknownHostException
189        usually if the IP address of the mail server could not be
190        determined. Possible causes are a broken network connection,
191        a wrong server name, an unreachable DNS server, etc.
192
193        @throws com::sun::star::io::NoRouteToHostException
194        if an error occured to connect to the remote mail server.
195        Typically the remote mail server cannot be reach because of an
196        intervening firewall, or if an intermediate router is down,
197        the network connection is broken, etc.
198
199        @throws com::sun::star::io::ConnectException
200        if an error occured while attempting to connect to the remote
201        mail server. Typically the connection was refused remotely,
202        because the mail server is not listening on the remote address/port.
203
204        @throws com::sun::star::auth::AuthenticationException
205        if the specified user could not be logged in.
206
207        @throws com::sun::star::mail::IllegalStateException
208        if a user is currently logged in.
209
210        @throws com::sun::star::mail::MailException
211        for other errors during login.
212
213        @see com::sun::star::mail::XAuthenticator
214        @see com::sun::star::io::AlreadyConnectedException
215        @see com::sun::star::io::UnknownHostException
216        @see com::sun::star::io::NoRouteToHostException
217        @see com::sun::star::io::ConnectException
218        @see com::sun::star::auth::AuthenticationException
219        @see com::sun::star::mail::IllegalStateException
220        @see com::sun::star::mail::MailException
221    */
222    void connectUser([in] XAuthenticator xAuthenticator)
223        raises(com::sun::star::io::AlreadyConnectedException,
224               com::sun::star::io::UnknownHostException,
225               com::sun::star::io::NoRouteToHostException,
226               com::sun::star::io::ConnectException,
227               com::sun::star::auth::AuthenticationFailedException,
228               com::sun::star::mail::MailException);
229
230    /**
231        Logoff the currently logged in user.
232
233        @throws com::sun::star::mail::MessagingException
234        if errors occur during logoff.
235    */
236    void disconnectUser()
237        raises(com::sun::star::mail::MailException);
238
239    /**
240        Returns whether a user is currently logged in to the mail server or not.
241
242        @returns
243        <TRUE/> if a user is currently logged in to the mail server.
244    */
245    boolean isUserConnected();
246
247    /**
248        Send a mail message to its recipients.
249
250        @throws com::sun::star::io::NotConnectedException
251        if no user is currently connected to the mail server.
252
253        @throws com::sun::star::mail::SendMailMessageFailedException
254        if the message could not be sent because of invalid recipient
255        addresses. The e-mail addresses of recipients have to conform to
256        <a href="http://www.ietf.org/rfc/rfc822.txt">RFC&nbsp;822</a>.
257
258        @throws com::sun::star::mail::MailException
259        is thrown on other errors that may happen during sending.
260        A possible reason may be for instance that a file attachment
261        specified in a mail message could not be found or accessed.
262
263        @throws com::sun::star::datatransfer::UnsupportedFlavorException
264        is thrown when the body of the mail message is provided in an
265        unsupported mime content type or may be thrown if one of the file
266        attachments specifies an unspupported mime content type.
267
268        @see com::sun::star::io::NotConnectedExceptionException
269        @see com::sun::star::mail::SendMailMessageFailedException
270        @see com::sun::star::mail::MailException
271        @see com::sun::star::datatransfer::UnsupportedFlavorException
272    */
273    void sendMailMessage([in] XMailMessage xMailMessage)
274        raises(com::sun::star::io::NotConnectedException, com::sun::star::mail::SendMailMessageFailedException, com::sun::star::mail::MailException, com::sun::star::datatransfer::UnsupportedFlavorException);
275};
276
277}; }; }; };
278
279#endif
280