Fixed/improved email provider

This commit is contained in:
M66B 2019-10-06 16:05:49 +02:00
parent 6b03106bc3
commit 98885428e8
1 changed files with 147 additions and 145 deletions

View File

@ -215,7 +215,7 @@ public class EmailProvider {
// https://wiki.mozilla.org/Thunderbird:Autoconfiguration // https://wiki.mozilla.org/Thunderbird:Autoconfiguration
HttpURLConnection request; HttpURLConnection request;
try { try {
URL url = new URL(" https://autoconfig." + domain + "/mail/config-v1.1.xml?emailaddress=someone@" + domain); URL url = new URL("https://autoconfig." + domain + "/mail/config-v1.1.xml?emailaddress=someone@" + domain);
Log.i("Fetching " + url); Log.i("Fetching " + url);
request = (HttpURLConnection) url.openConnection(); request = (HttpURLConnection) url.openConnection();
@ -252,6 +252,7 @@ public class EmailProvider {
} }
} }
try {
// https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser // https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser
XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
XmlPullParser xml = factory.newPullParser(); XmlPullParser xml = factory.newPullParser();
@ -407,8 +408,9 @@ public class EmailProvider {
eventType = xml.next(); eventType = xml.next();
} }
} finally {
request.disconnect(); request.disconnect();
}
Log.i("imap=" + provider.imap.host + ":" + provider.imap.port + ":" + provider.imap.starttls); Log.i("imap=" + provider.imap.host + ":" + provider.imap.port + ":" + provider.imap.starttls);
Log.i("smtp=" + provider.smtp.host + ":" + provider.smtp.port + ":" + provider.smtp.starttls); Log.i("smtp=" + provider.smtp.host + ":" + provider.smtp.port + ":" + provider.smtp.starttls);