1 package com.atlassian.mail.server;
2
3 import com.atlassian.mail.Email;
4 import com.atlassian.mail.MailConstants;
5 import com.atlassian.mail.MailException;
6 import com.atlassian.mail.MailProtocol;
7
8 import java.io.PrintStream;
9
10 public interface SMTPMailServer extends MailServer
11 {
12 @Deprecated
13 String DEFAULT_SMTP_PORT = MailConstants.DEFAULT_SMTP_PORT;
14
15 String getDefaultFrom();
16
17 void setDefaultFrom(String from);
18
19 String getPrefix();
20
21 void setPrefix(String prefix);
22
23 boolean isSessionServer();
24
25 void setSessionServer(boolean sessionServer);
26
27 String getJndiLocation();
28
29 void setJndiLocation(String jndiLocation);
30
31 public boolean isRemovePrecedence();
32
33 public void setRemovePrecedence(boolean precedence);
34
35 /**
36 * Sends the given email.
37 * <p>
38 * For backward-compatibility, this method will ignore any Message-ID header set in the email parameter, and let
39 * JavaMail set its own Message-ID, then populate the header in the email parameter.
40 *
41 * @param email the Email to send.
42 * @throws MailException if the email could not be sent
43 *
44 * @see #sendWithMessageId(com.atlassian.mail.Email, String)
45 */
46 void send(Email email) throws MailException;
47
48 /**
49 * Sends the given email using the given Message-ID header.
50 * <p>
51 * Note that this is an advanced method and should only be used if you understand the requirements and restrictions
52 * as per <a href="http://www.faqs.org/rfcs/rfc2822.html">RFC 2822</a>;
53 * namely that the message-ID must be globally unique and can only contain certain ASCII characters.
54 * <p>
55 * If the given messageId parameter is null, then we let JavaMail create a Message-ID.
56 * Note that (for back-compatibility reasons) the email.getMessageId() is ignored for input, but set with the actual Message-ID used.
57 *
58 * @param email the Email to send.
59 * @param messageId the desired Message-ID header, or null to let JavaMail create one automatically.
60 * Do not include the angle-brackets - these will be added automatically.
61 * @throws MailException if the email could not be sent
62 *
63 * @see #send(com.atlassian.mail.Email)
64 */
65 void sendWithMessageId(Email email, String messageId) throws MailException;
66
67 /**
68 * World's stupidest method - it catches all Exceptions and then declares anyway that it throws MailException.
69 * @param email
70 * @throws MailException
71 *
72 * @deprecated Use {@link #send(com.atlassian.mail.Email)} instead and deal with the Exception for yourself. Since v2.5.
73 */
74 void quietSend(Email email) throws MailException;
75
76 /**
77 * Enable or disable SMTP-level logging.
78 *
79 * @param debug Turn debugging on or off
80 */
81 void setDebug(boolean debug);
82
83 /**
84 * Whether logging is enabled.
85 */
86 boolean getDebug();
87
88 /**
89 * Where debug logs currently go to.
90 * @return print stream where debug info is logged to
91 */
92 PrintStream getDebugStream();
93
94 boolean isTlsRequired();
95
96 void setTlsRequired(boolean tlsRequired);
97
98
99 }