|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.mail.Service
javax.mail.Transport
org.apache.geronimo.javamail.transport.smtp.SMTPTransport
public class SMTPTransport
Simple implementation of SMTP transport. Just does plain RFC821-ish delivery.
Supported properties :
| Field Summary | |
|---|---|
protected SMTPConnection |
connection
|
protected static String |
DEFAULT_MAIL_HOST
|
protected static int |
DEFAULT_MAIL_SMTP_PORT
|
protected static int |
DEFAULT_MAIL_SMTPS_PORT
|
protected org.apache.geronimo.javamail.transport.smtp.SMTPReply |
lastServerResponse
|
protected static String |
MAIL_SMTP_DSN_NOTIFY
property keys for protocol properties. |
protected static String |
MAIL_SMTP_EXTENSION
|
protected static String |
MAIL_SMTP_SENDPARTIAL
|
protected ProtocolProperties |
props
|
protected boolean |
sslConnection
|
| Fields inherited from class javax.mail.Service |
|---|
debug, session, url |
| Constructor Summary | |
|---|---|
|
SMTPTransport(Session session,
URLName name)
Normal constructor for an SMTPTransport() object. |
protected |
SMTPTransport(Session session,
URLName name,
String protocol,
int defaultPort,
boolean sslConnection)
Common constructor used by the SMTPTransport and SMTPSTransport classes to do common initialization of defaults. |
| Method Summary | |
|---|---|
void |
close()
Close the connection. |
void |
connect(Socket socket)
Connect to a server using an already created socket. |
protected Address[] |
expandGroups(Address[] addresses)
Expand the address list by converting any group addresses into single address targets. |
protected MessagingException |
generateExceptionChain(SMTPConnection.SendStatus[] stats,
boolean reportSuccess)
Turn a series of send status items into a chain of exceptions indicating the state of each send operation. |
protected String |
getDeliveryStatusNotification(Message message)
Determine what delivery status notification should be added to the RCPT TO: command. |
String |
getLocalHost()
Retrieve the local client host name. |
boolean |
getReportSuccess()
Return the current reportSuccess property. |
String |
getSASLRealm()
Retrieve the SASL realm used for DIGEST-MD5 authentication. |
boolean |
getStartTLS()
Return the current startTLS property. |
protected boolean |
protocolConnect(String host,
int port,
String username,
String password)
Do the protocol connection for an SMTP transport. |
void |
sendMessage(Message message,
Address[] addresses)
Send a message to multiple addressees. |
void |
setLocalHost(String localHost)
Explicitly set the local host information. |
void |
setReportSuccess(boolean report)
Set a new value for the reportSuccess property. |
void |
setSASLRealm(String name)
Explicitly set the SASL realm used for DIGEST-MD5 authenticaiton. |
void |
setStartTLS(boolean start)
Set a new value for the startTLS property. |
| Methods inherited from class javax.mail.Transport |
|---|
addTransportListener, notifyTransportListeners, removeTransportListener, send, send |
| Methods inherited from class javax.mail.Service |
|---|
addConnectionListener, connect, connect, connect, connect, finalize, getURLName, isConnected, notifyConnectionListeners, queueEvent, removeConnectionListener, setConnected, setURLName, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final String MAIL_SMTP_DSN_NOTIFY
protected static final String MAIL_SMTP_SENDPARTIAL
protected static final String MAIL_SMTP_EXTENSION
protected static final String DEFAULT_MAIL_HOST
protected static final int DEFAULT_MAIL_SMTP_PORT
protected static final int DEFAULT_MAIL_SMTPS_PORT
protected boolean sslConnection
protected ProtocolProperties props
protected SMTPConnection connection
protected org.apache.geronimo.javamail.transport.smtp.SMTPReply lastServerResponse
| Constructor Detail |
|---|
public SMTPTransport(Session session,
URLName name)
session - The attached session.name - An optional URLName object containing target information.
protected SMTPTransport(Session session,
URLName name,
String protocol,
int defaultPort,
boolean sslConnection)
session - The host session instance.name - The URLName of the target.protocol - The protocol type (either "smtp" or "smtps". This helps us in
retrieving protocol-specific session properties.defaultPort - The default port used by this protocol. For "smtp", this will
be 25. The default for "smtps" is 465.sslConnection - Indicates whether an SSL connection should be used to initial
contact the server. This is different from the STARTTLS
support, which switches the connection to SSL after the
initial startup.| Method Detail |
|---|
public void connect(Socket socket)
throws MessagingException
socket - The socket connection to use.
MessagingException
protected boolean protocolConnect(String host,
int port,
String username,
String password)
throws MessagingException
protocolConnect in class Servicehost - The target host name.port - The server port number.user - The authentication user (if any).password - The server password. Might not be sent directly if more
sophisticated authentication is used.
MessagingException
public void sendMessage(Message message,
Address[] addresses)
throws MessagingException
sendMessage in class Transportmessage - The message we're sending.addresses - An array of addresses to send to.
MessagingExceptionprotected String getDeliveryStatusNotification(Message message)
message - The message we're sending.
public void close()
throws MessagingException
close in class ServiceMessagingException
protected MessagingException generateExceptionChain(SMTPConnection.SendStatus[] stats,
boolean reportSuccess)
stats - The list of SendStatus items.reportSuccess - Indicates whether we should include the report success items.
protected Address[] expandGroups(Address[] addresses)
throws MessagingException
addresses - The input array of addresses.
MessagingException
public String getLocalHost()
throws MessagingException
SMTPTransportException
MessagingExceptionpublic void setLocalHost(String localHost)
localHost - The new localHost name.public boolean getReportSuccess()
public void setReportSuccess(boolean report)
report - The new setting.public boolean getStartTLS()
public void setStartTLS(boolean start)
start - The new setting.public String getSASLRealm()
public void setSASLRealm(String name)
name - The new realm name.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||