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