|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.geronimo.javamail.util.MailConnection org.apache.geronimo.javamail.transport.smtp.SMTPConnection
public class SMTPConnection
Simple implementation of SMTP transport. Just does plain RFC977-ish delivery.
Nested Class Summary | |
---|---|
static class |
SMTPConnection.SendStatus
Simple holder class for the address/send status duple, as we can have mixed success for a set of addresses and a message |
Field Summary | |
---|---|
protected static int |
DEFAULT_NNTP_PORT
property keys for protocol properties. |
protected org.apache.geronimo.javamail.transport.smtp.SMTPReply |
lastServerResponse
|
protected static String |
MAIL_SMTP_ALLOW8BITMIME
|
protected static String |
MAIL_SMTP_AUTH
|
protected static String |
MAIL_SMTP_DSN_RET
|
protected static String |
MAIL_SMTP_EHLO
|
protected static String |
MAIL_SMTP_EXTENSION
|
protected static String |
MAIL_SMTP_FROM
|
protected static String |
MAIL_SMTP_QUITWAIT
|
protected static String |
MAIL_SMTP_REPORT_SUCCESS
|
protected static String |
MAIL_SMTP_STARTTLS_ENABLE
|
protected static String |
MAIL_SMTP_SUBMITTER
|
protected BufferedReader |
reader
|
protected boolean |
reportSuccess
|
protected boolean |
serverTLS
|
protected boolean |
use8bit
|
protected boolean |
useTLS
|
protected PrintWriter |
writer
|
Constructor Summary | |
---|---|
SMTPConnection(ProtocolProperties props)
Normal constructor for an SMTPConnection() object. |
Method Summary | |
---|---|
void |
close()
Close the connection. |
protected boolean |
convertTransferEncoding(MimePart bodyPart)
Check to see if a MIME body part can have its encoding changed from quoted-printable or base64 encoding to 8bit encoding. |
String |
extensionParameter(String name)
Retrieve any argument information associated with a extension reported back by the server on the EHLO command. |
protected String |
fixEmailAddress(String mail)
Convert an InternetAddress into a form sendable on an SMTP mail command. |
protected void |
getConnectedTLSSocket()
Switch the connection to using TLS level security, switching to an SSL socket. |
org.apache.geronimo.javamail.transport.smtp.SMTPReply |
getLastServerResponse()
Retrieve the last response received from the SMTP server. |
protected org.apache.geronimo.javamail.transport.smtp.SMTPReply |
getReply()
Get a reply line for an SMTP command. |
boolean |
getReportSuccess()
Return the current reportSuccess property. |
protected ClientAuthenticator |
getSaslAuthenticator()
Attempt to retrieve a SASL authenticator for this protocol. |
protected int |
getSizeEstimate(Message msg)
Get an estimate of the transmission size for this message. |
boolean |
getStartTLS()
Return the current startTLS property. |
protected boolean |
getWelcome()
Get the server's welcome blob from the wire.... |
protected boolean |
isValid8bit(InputStream inStream)
Read the bytes in a stream a test to see if this conforms to the RFC 2045 rules for 8bit encoding. 1) No more than 998 bytes long 2) All lines are terminated with CRLF sequences 3) CR and LF characters only occur in properly formed line separators 4) No null characters are allowed. |
protected boolean |
processAuthentication()
Authenticate with the server, if necessary (or possible). |
protected void |
processExtension(String extension)
Process an extension string passed back as the EHLP response. |
boolean |
protocolConnect(String host,
int port,
String username,
String password)
Connect to the server and do the initial handshaking. |
protected String |
receiveLine()
Receives one line from the server. |
protected String |
receiveLine(int delayMillis)
Receives one line from the server. |
void |
resetConnection()
Reset the server connection after an error. |
protected org.apache.geronimo.javamail.transport.smtp.SMTPReply |
sendCommand(String data)
Send a command to the server, returning the first response line back as a reply. |
protected void |
sendData(Message msg)
Sends the data in the message down the socket. |
protected boolean |
sendEhlo()
Send the EHLO command to the SMTP server. |
protected boolean |
sendHandshake()
Start the handshake process with the server, including setting up and TLS-level work. |
protected void |
sendHelo()
Send the HELO command to the SMTP server. |
protected void |
sendLine(String data)
Sends a message down the socket and terminates with the appropriate CRLF |
protected boolean |
sendMailFrom(Message message)
Set the sender for this mail. |
protected void |
sendQuit()
Sends the QUIT message and receieves the response |
SMTPConnection.SendStatus |
sendRcptTo(InternetAddress addr,
String dsn)
Sets a receiver address for the current message |
void |
setReportSuccess(boolean report)
Set a new value for the reportSuccess property. |
void |
setStartTLS(boolean start)
Set a new value for the startTLS property. |
boolean |
supportsExtension(String name)
Tests whether the target server supports a named extension. |
String |
toString()
|
Methods inherited from class org.apache.geronimo.javamail.util.MailConnection |
---|
checkConnected, closeServerConnection, connect, debugOut, debugOut, getCapabilities, getConnectedSocket, getConnectedSSLSocket, getConnection, getConnectionProperties, getConnectionStreams, getHost, getLocalHost, getLoginAuthenticator, getSaslMechanisms, getSASLRealm, getServerMechanisms, hasCapability, selectSaslMechanisms, setLocalHost, setSASLRealm, supportsMechanism |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final String MAIL_SMTP_QUITWAIT
protected static final String MAIL_SMTP_EXTENSION
protected static final String MAIL_SMTP_EHLO
protected static final String MAIL_SMTP_ALLOW8BITMIME
protected static final String MAIL_SMTP_REPORT_SUCCESS
protected static final String MAIL_SMTP_STARTTLS_ENABLE
protected static final String MAIL_SMTP_AUTH
protected static final String MAIL_SMTP_FROM
protected static final String MAIL_SMTP_DSN_RET
protected static final String MAIL_SMTP_SUBMITTER
protected static final int DEFAULT_NNTP_PORT
protected org.apache.geronimo.javamail.transport.smtp.SMTPReply lastServerResponse
protected BufferedReader reader
protected PrintWriter writer
protected boolean reportSuccess
protected boolean serverTLS
protected boolean useTLS
protected boolean use8bit
Constructor Detail |
---|
public SMTPConnection(ProtocolProperties props)
props
- The property bundle for this protocol instance.Method Detail |
---|
public boolean protocolConnect(String host, int port, String username, String password) throws MessagingException
protocolConnect
in class MailConnection
host
- The target host name.port
- The target portusername
- The connection username (can be null)password
- The authentication password (can be null).
MessagingException
public void close() throws MessagingException
MessagingException
public String toString()
toString
in class Object
protected boolean sendMailFrom(Message message) throws MessagingException
message
- The message we're sending.
MessagingException
protected boolean convertTransferEncoding(MimePart bodyPart)
bodyPart
- The bodyPart to convert. Initially, this will be
the message itself.
protected boolean getWelcome() throws MessagingException
MessagingException
protected int getSizeEstimate(Message msg)
msg
- The message we're sending.
protected void sendData(Message msg) throws MessagingException
MessagingException
protected void sendQuit() throws MessagingException
MessagingException
public SMTPConnection.SendStatus sendRcptTo(InternetAddress addr, String dsn) throws MessagingException
addr
- The target address.dsn
- An optional DSN option appended to the RCPT TO command.
MessagingException
protected org.apache.geronimo.javamail.transport.smtp.SMTPReply sendCommand(String data) throws MessagingException
data
- The data to send.
MessagingException
protected void sendLine(String data) throws MessagingException
MessagingException
protected String receiveLine() throws MessagingException
MessagingException
protected org.apache.geronimo.javamail.transport.smtp.SMTPReply getReply() throws MessagingException
MessagingException
public org.apache.geronimo.javamail.transport.smtp.SMTPReply getLastServerResponse()
protected String receiveLine(int delayMillis) throws MessagingException
MessagingException
protected String fixEmailAddress(String mail)
mail
- The mail address returned from InternetAddress.getAddress().
protected boolean sendHandshake() throws MessagingException
MessagingException
protected void getConnectedTLSSocket() throws MessagingException
getConnectedTLSSocket
in class MailConnection
MessagingException
protected boolean sendEhlo() throws MessagingException
SMTPTransportException
MalformedSMTPReplyException
MessagingException
protected void sendHelo() throws MessagingException
MessagingException
public boolean getStartTLS()
public void setStartTLS(boolean start)
start
- The new setting.protected void processExtension(String extension)
extension
- The string value of the extension (which will be of the form
"NAME arguments").public String extensionParameter(String name)
name
- The name of the target server extension.
public boolean supportsExtension(String name)
name
- The target extension name.
protected boolean processAuthentication() throws MessagingException
MessagingException
protected ClientAuthenticator getSaslAuthenticator()
protected boolean isValid8bit(InputStream inStream)
inStream
- The source input stream.
public void resetConnection() throws MessagingException
MessagingException
public boolean getReportSuccess()
public void setReportSuccess(boolean report)
report
- The new setting.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |