mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 00:58:50 -05:00
If an SMTP server tells us how big the biggest message they accept is,
don't even try to deliver it to them
This commit is contained in:
parent
97ec38d03f
commit
03d05e9331
@ -13,6 +13,7 @@ import com.fsck.k9.mail.filter.PeekableInputStream;
|
||||
import com.fsck.k9.mail.filter.SmtpDataStuffing;
|
||||
import com.fsck.k9.mail.internet.MimeUtility;
|
||||
import com.fsck.k9.mail.store.TrustManagerFactory;
|
||||
import com.fsck.k9.mail.store.LocalStore.LocalMessage;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLException;
|
||||
@ -306,13 +307,23 @@ public class SmtpTransport extends Transport {
|
||||
|
||||
private void sendMessageTo(ArrayList<String> addresses, Message message)
|
||||
throws MessagingException {
|
||||
boolean possibleSend = false;
|
||||
|
||||
close();
|
||||
open();
|
||||
|
||||
message.setEncoding(m8bitEncodingAllowed ? "8bit" : null);
|
||||
// If the message has attachments and our server has told us about a limit on
|
||||
// the size of messages, count the message's size before sending it
|
||||
if (mLargestAcceptableMessage > 0 && ((LocalMessage)message).hasAttachments()) {
|
||||
if (message.calculateSize() > mLargestAcceptableMessage) {
|
||||
MessagingException me = new MessagingException("Message too large for server");
|
||||
me.setPermanentFailure(possibleSend);
|
||||
throw me;
|
||||
}
|
||||
}
|
||||
|
||||
Address[] from = message.getFrom();
|
||||
boolean possibleSend = false;
|
||||
try {
|
||||
//TODO: Add BODY=8BITMIME parameter if appropriate?
|
||||
executeSimpleCommand("MAIL FROM: " + "<" + from[0].getAddress() + ">");
|
||||
|
Loading…
Reference in New Issue
Block a user