1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

Pull out the maximum acceptable message size from SMTP servers that tell

us when we EHLO.

Next step is to _use_ this data.
This commit is contained in:
Jesse Vincent 2011-03-27 15:29:08 +08:00
parent c9510f8f16
commit c8d38da568

View File

@ -62,6 +62,8 @@ public class SmtpTransport extends Transport {
OutputStream mOut;
private boolean m8bitEncodingAllowed;
private int mLargestAcceptableMessage;
/**
* smtp://user:password@server:port CONNECTION_SECURITY_NONE
* smtp+tls://user:password@server:port CONNECTION_SECURITY_TLS_OPTIONAL
@ -185,6 +187,8 @@ public class SmtpTransport extends Transport {
m8bitEncodingAllowed = results.contains("8BITMIME");
/*
* TODO may need to add code to fall back to HELO I switched it from
* using HELO on non STARTTLS connections because of AOL's mail
@ -235,6 +239,15 @@ public class SmtpTransport extends Transport {
if (result.matches(".*AUTH.*CRAM-MD5.*$") && mAuthType != null && mAuthType.equals("CRAM_MD5")) {
authCramMD5Supported = true;
}
if (result.matches(".*SIZE \\d*$")) {
try {
mLargestAcceptableMessage = Integer.parseInt( result.substring(result.lastIndexOf(' ') + 1));
} catch (Exception e) {
if (K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
Log.d(K9.LOG_TAG, "Tried to parse "+result+" and get an int out of the last word: "+e);
}
}
}
}
if (mUsername != null && mUsername.length() > 0 && mPassword != null